diff --git a/examples/api-routes-apollo-server-and-client/apollo/client.js b/examples/api-routes-apollo-server-and-client/apollo/client.js index 4bba2b5af438..effd1af547a0 100644 --- a/examples/api-routes-apollo-server-and-client/apollo/client.js +++ b/examples/api-routes-apollo-server-and-client/apollo/client.js @@ -1,4 +1,4 @@ -import React, { useMemo } from 'react' +import React from 'react' import Head from 'next/head' import { ApolloProvider } from '@apollo/react-hooks' import { ApolloClient } from 'apollo-client' @@ -16,10 +16,7 @@ let apolloClient = null */ export function withApollo (PageComponent, { ssr = true } = {}) { const WithApollo = ({ apolloClient, apolloState, ...pageProps }) => { - const client = useMemo( - () => apolloClient || initApolloClient(apolloState), - [] - ) + const client = apolloClient || initApolloClient(apolloState) return ( diff --git a/examples/with-apollo-auth/lib/apollo.js b/examples/with-apollo-auth/lib/apollo.js index 592b971eea58..71f81a8ee8d4 100644 --- a/examples/with-apollo-auth/lib/apollo.js +++ b/examples/with-apollo-auth/lib/apollo.js @@ -1,4 +1,4 @@ -import React, { useMemo } from 'react' +import React from 'react' import PropTypes from 'prop-types' import cookie from 'cookie' import Head from 'next/head' @@ -19,15 +19,7 @@ import fetch from 'isomorphic-unfetch' */ export function withApollo (PageComponent, { ssr = true } = {}) { const WithApollo = ({ apolloClient, apolloState, ...pageProps }) => { - const client = useMemo(() => { - // We pass in the apolloClient directly when using getDataFromTree - if (apolloClient) { - return apolloClient - } - - // Otherwise initClient using apolloState - return initApolloClient(apolloState, { getToken }) - }, []) + const client = apolloClient || initApolloClient(apolloState, { getToken }) return ( diff --git a/examples/with-apollo/lib/apollo.js b/examples/with-apollo/lib/apollo.js index 303826b44c09..92007ffc300e 100644 --- a/examples/with-apollo/lib/apollo.js +++ b/examples/with-apollo/lib/apollo.js @@ -1,4 +1,4 @@ -import React, { useMemo } from 'react' +import React from 'react' import Head from 'next/head' import { ApolloProvider } from '@apollo/react-hooks' import { ApolloClient } from 'apollo-client' @@ -18,10 +18,7 @@ let apolloClient = null */ export function withApollo (PageComponent, { ssr = true } = {}) { const WithApollo = ({ apolloClient, apolloState, ...pageProps }) => { - const client = useMemo( - () => apolloClient || initApolloClient(apolloState), - [] - ) + const client = apolloClient || initApolloClient(apolloState) return (