【发布时间】:2018-05-19 21:58:58
【问题描述】:
当 props 在 redux 存储中更新时,我需要调用一个查询。但它不是那样发生的,在加载组件时只调用一次查询。
我的代码是这样的--
const sampleData = compose(graphql(ITEMS_BY_CATEGORY, {name:"itemByCategory", options: (props) => ({variables: {_id:props.user._id,searchstring:"", start:0,limit:10, itemype:"created",categoryid:props.categoryid}})}))(samplePage)
export default connect(
(state) => ({user: state.user.user,categoryid: state.item.categoryid}),
{}
)(sampleData);
我在 props 更新后尝试了 refetch 方法。喜欢 - this.props.data.refetch()。但它也没有工作。
【问题讨论】:
标签: reactjs apollo react-apollo apollo-client