我正在尝试使用 aor-simple-graphql-client 进行管理员休息,并使用 react-boilerplate。
我在尝试创建 Apollo 客户端时遇到了一个简单的错误。
文件:管理员上的 App.js
class App extends Component {
constructor() {
super();
this.state = { restClient: null };
}
componentDidMount() {
createRestClient().then((restClient) => this.setState({ restClient }));
}
render() {
const { restClient } = this.state;
if (!restClient) {
return <div>Loading</div>;
}
...
当我导航到 localhost/admin 时,我收到一个错误 Uncaught (in promise) ... restClient 永远不会初始化。我很确定这是一个基本错误,但我无法通过它。
有人可以帮我吗?
我的回购:https ://github.com/romainquellec/cuistot
谢谢。
更多关于错误:它可能只是一个配置错误。我无法初始化 restClient,喜欢 componentDidMount 被调用。
我尝试了不同的方法,灵感来自您的项目,但没有结果。