Skip to content

reactgraphqlacademy/bootcamp-hackathon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 

Repository files navigation

ReactJS Academy Hackathon

hackathon ideas


Resources


Tutorials

If you want to work with GraphQL

npm install --save apollo-boost react-apollo graphql graphql-tag

or

yarn add apollo-boost react-apollo graphql graphql-tag

in your root app file (App.js or Root.js)

import ApolloClient from "apollo-boost";
import { ApolloProvider } from "react-apollo";

const client = new ApolloClient({
  uri: "GRAPHQL_API_ENDPOINT" // example: https://api.github.com/graphql
});

function App() {
  return (
    <ApolloProvider client={client}>
      <MyAwesomeApp />
    </ApolloProvider>
  );
}

If you want to use the Github GraphQL API, you need to create a token and add it as a header to every request like this:

const client = new ApolloClient({
  uri: "https://api.github.com/graphql",
  headers: {
    Authorization: "bearer YOUR_GITHUB_TOKEN"
  }
});

you can see all the configuration options here: https://www.apollographql.com/docs/react/essentials/get-started.html#configuration


Happy Coding! :)