Created
June 2, 2018 09:39
-
-
Save larkintuckerllc/2e74187e1693421365d7276d10e99f96 to your computer and use it in GitHub Desktop.
Apollo Client by Example: Part 1 - 1
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
| import { ApolloClient } from 'apollo-client'; | |
| import { withClientState } from 'apollo-link-state'; | |
| import { InMemoryCache } from 'apollo-cache-inmemory'; | |
| import { ApolloProvider } from 'react-apollo'; | |
| import React from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| import defaults from './graphql/defaults'; | |
| import resolvers from './graphql/resolvers'; | |
| import typeDefs from './graphql/typeDefs'; | |
| import './index.css'; | |
| import App from './App'; | |
| import registerServiceWorker from './registerServiceWorker'; | |
| const cache = new InMemoryCache(); | |
| const client = new ApolloClient({ | |
| cache, | |
| link: withClientState({ resolvers, defaults, cache, typeDefs }), | |
| }); | |
| ReactDOM.render( | |
| <ApolloProvider client={client}> | |
| <App /> | |
| </ApolloProvider>, | |
| document.getElementById('root') | |
| ); | |
| registerServiceWorker(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment