Created
August 11, 2019 09:16
-
-
Save bartcis/6ad3c47f9548fbc36eceade6d23891dd to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Context for React Apollo | |
const httpLinkReactApollo = createHttpLink({ | |
uri: 'http://localhost:4000' | |
}); | |
const clientReactApollo = new ApolloClient({ | |
link: httpLinkReactApollo, | |
cache: new InMemoryCache() | |
}); | |
// Context for GraphQL Hooks | |
const clientGraphQLHooks = new GraphQLClient({ | |
url: 'http://localhost:4000', | |
cache: memCache(), | |
}); | |
ReactDOM.render( | |
// Remove this wrap if you use GrapQL Hooks | |
<ApolloProvider client={clientReactApollo}> | |
{/* Remove this wrap if you use React Apollo */} | |
<ClientContext.Provider value={clientGraphQLHooks}> | |
<App /> | |
</ClientContext.Provider> | |
</ApolloProvider>, | |
document.getElementById('root') | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment