【发布时间】:2018-04-27 05:39:25
【问题描述】:
我正在关注 this tutorial 并尝试实现 graphQl。以下行有问题:
const client = new ApolloClient();
奇怪的是,我在 react-apollo GitHub 页面中找不到任何内容。是不是我做错了什么愚蠢的事情。
import React, { Component } from 'react';
import ChannelsList from './ChannelsList.js';
import './App.css';
import {
ApolloClient,
gpl,
graphql,
ApolloProvider
} from 'react-apollo';
//issue with this line
const client = new ApolloClient();
const channelsListQuery = `
query ChannelsListQuery {
channels {
id,
name
}
}
`;
const ChannelsListWithData = graphql(channelsListQuery)(ChannelsList);
class App extends Component {
render() {
return (
<ApolloProvider client={client}>
<ChannelsListWithData />
</ApolloProvider>
);
}
}
export default App;
【问题讨论】:
-
你试过从'apollo-client'导入ApolloClient吗?
标签: javascript reactjs apollo react-apollo