我在使用React的Apollo客户端版本2时遇到了问题.(https://www.apollographql.com/docs/react/)
当我根据文档设置Apollo客户端时,我无法在GraphQl服务器上进行查询,它会引发错误:
Uncaught (in promise) TypeError: _super.call is not a function
at new ObservableQuery (ObservableQuery.js:36)
at QueryManager.watchQuery (QueryManager.js:393)
at QueryManager.js:420
at new Promise (<anonymous>)
at QueryManager.query (QueryManager.js:418)
at ApolloClient.query (ApolloClient.js:86)
at Object._typeof (index.js:21)
at __webpack_require__ (bootstrap 4164d2c8f7d280e544dd:19)
at Object.<anonymous> (location.js:34)
at __webpack_require__ (bootstrap 4164d2c8f7d280e544dd:19)
Run Code Online (Sandbox Code Playgroud)
我的代码在这里:
import { ApolloClient } from "apollo-client";
import { HttpLink } from "apollo-link-http";
import { InMemoryCache } from "apollo-cache-inmemory";
import gql from "graphql-tag";
const client = new ApolloClient({
link: new HttpLink({ uri: "https://q80vw8qjp.lp.gql.zone/graphql" }), …Run Code Online (Sandbox Code Playgroud)