Last active
September 4, 2019 14:27
-
-
Save JeffMatsonPagely/27bf5974bc2a87a87ff5baa921eb586e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fetch from ‘isomorphic-fetch’; | |
import React from ‘react’; | |
import { ApolloProvider } from 'react-apollo'; | |
import ApolloClient from 'apollo-boost'; | |
// Wraps the entire Gatsby app with Apollo. | |
export const wrapRootElement = ({ element }) => { | |
// Register a new Apollo client. | |
const client = new ApolloClient({ | |
fetch, | |
// Change this to your GraphQL endpoint. | |
uri: 'http://example.com/graphql', | |
}); | |
// Wrap the element. | |
return <ApolloProvider client={client}>{element}</ApolloProvider>; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment