React Apollo Error: Invariant Violation: Could not find “client” in the context or passed in as an option

前端 未结 5 1552
一整个雨季
一整个雨季 2021-01-12 04:28

I\'m building a project using React, Apollo and Next.js. I\'m trying to update react-apollo to 3.1.3 and I\'m now getting the following error when viewing the site.

5条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-12 05:07

    import gql from 'graphql-tag';
    import {graphql} from '@apollo/react-hoc';
    import { ApolloClient, InMemoryCache } from '@apollo/client';
    import { ApolloProvider } from '@apollo/react-hooks';
    

    These imports worked for me perfectly. I had a great time debugging and finding different import libraries but finally after 3 hours this was the solution for using graphql and appolo.

提交回复
热议问题