Skip to content

Instantly share code, notes, and snippets.

@SaraVieira
Last active June 11, 2018 13:08
Show Gist options
  • Save SaraVieira/2489f2ad0b8959130bc5e23fde57c06d to your computer and use it in GitHub Desktop.
Save SaraVieira/2489f2ad0b8959130bc5e23fde57c06d to your computer and use it in GitHub Desktop.
import { InMemoryCache } from 'apollo-cache-inmemory'
import { ApolloClient } from 'apollo-client'
import { HttpLink } from 'apollo-link-http'
export default new ApolloClient({
connectToDevTools: process.browser,
ssrMode: !process.browser,
link: new HttpLink({
uri: 'https://api.graphcms.com/simple/v1/cjhdcwrb98if90109o4pzawaq'
}),
cache: process.browser
? new InMemoryCache().restore(window.__APOLLO_STATE__)
: new InMemoryCache()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment