将ApolloProvider导入为组件

时间:2018-02-01 16:53:17

标签: reactjs apollo graphql-js react-apollo

我想在项目中使用react-apollo

按照the usage section中的设置步骤操作,如果<ApolloProvider>是我的React Component树的根,我可以让import { ApolloProvider } from 'react-apollo'; ReactDOM.render( <ApolloProvider client={client}> <MyRootComponent /> </ApolloProvider>, document.getElementById('root'), ); 正常工作:

<ApolloProvider>

但是,我想将Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object. Check the render method of `MyGraphQl`. 作为组件导入我的树中,而不是根目录。

当我尝试这样做时,我得到了这个错误:

SQLiteDatabase sq = this.getReadableDatabase();
        ContentValues c = new ContentValues();
        try {
            String Name="نمونہ";
            c.put("Name", new String(Name.getBytes(), "UTF-8"));

        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        sq.insert("tableName", null, c);

有没有办法将其作为普通组件导入?

0 个答案:

没有答案