![](/img/trans.png)
[英]React-apollo update not reloading after mutation if I transform data before the render()
[英]react-apollo providing data and mutation to the component
我以前使用prevues版本,我可以使用connect来为组件提供数据和变异方法,如下所示:
export default connect({
mapQueriesToProps,
mapMutationsToProps,
})(component);
在每个mapQueriesToProps
和mapMutationsToProps
我可以提供许多实例,例如2-3个数据查询和几个变异方法。
但是我怎么能在新版本中使用以下模式呢?
export default graphql(data, {
options: ({ params: { id } }) => ({
variables: {
id: Number(id),
},
}),
})(component);
你可以多次使用compose
。
编写所有突变和所有查询,然后在组件中组合它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.