在上下文中找不到“客户端”或作为道具传递。将根组件包装在<apolloprovider>中,

时间:2019-04-28 19:59:49

标签: node.js reactjs graphql apollo

应用无法与客户端连接

`
const client = new ApolloClient();
const root = document.querySelector("#root");
ReactDOM.render( 
 <div>
<ApolloProvider client={client}>
    <App />

    </ApolloProvider>,
<Router>
    <div>
        <Route exact path='/' component={App}/>
        <Route exact path='/edit/:id' component={Edit}/>
        <Route exact path='/create' component={Create}/>
        <Route exact path='/show/:id' component={Show}/>
    </div>
</Router>
 </div>,
`

错误结果在这里... 模块../src/index.js     src / index.js:20       17 |       18 | const client = new ApolloClient();       19 | const root = document.querySelector(“#root”);

  

20 | ReactDOM.render(         21 |         22 |         23 |

0 个答案:

没有答案