【发布时间】:2018-11-05 01:53:45
【问题描述】:
我需要在组件的滚动视图中使用数据道具进行刷新。所以我需要在我的onRefresh 中调用data.refetch 进行复习。但我得到 data prop is undefined 错误。
代码:
class abc extends Component {
render() {
return (
<View>
<ScrollView
onRefresh={this.props.data.refetch} // undefined error
refreshing={this.props.data.loading} // undefined erro
>
.....
</ScrollView>
</View>
);
}
}
export default compose(
....,
graphql(
MyQuery,{
.....
}
)
)(abc);
为什么我的数据道具是未定义的?
【问题讨论】:
-
没有。我没有用名字。我只需要刷新数据。无论如何,我已经通过将 props.data.refetch 映射到容器中的道具来解决这个问题。谢谢。
标签: react-native amazon-dynamodb react-apollo apollo-client aws-appsync