rsnext/examples/with-graphql-hooks/pages/_app.js
Luis Alvarez D b4ec992815
[Examples] Move with-graphql-hooks to SSG (#13858)
Related to https://github.com/vercel/next.js/issues/11014

The setup is very similar to the one used for Apollo examples.

@Joezo I've removed the demo example that you added to the readme (https://github.com/vercel/next.js/pull/6482) as it will be outdated after this PR is merged.
2020-06-08 16:23:34 +00:00

12 lines
366 B
JavaScript

import { ClientContext } from 'graphql-hooks'
import { useGraphQLClient } from '../lib/graphql-client'
export default function App({ Component, pageProps }) {
const graphQLClient = useGraphQLClient(pageProps.initialGraphQLState)
return (
<ClientContext.Provider value={graphQLClient}>
<Component {...pageProps} />
</ClientContext.Provider>
)
}