我想在单击loadMore之后以redux形式分派一个函数,我已经从API提取了数据,我只需要一次渲染记录切片。
const mapDispatchToProps = (dispatch) => {
return {
loadMore: (value) => {
dispatch(value);
},
}}
loadMore = () => {
this.setState({
pageNo: this.state.pageNo + 2,
}, () => {
setTimeout(() => {
console.log(this.props);
this.props.loadMore(this.getData())
}, 200);
});
}
<FieldArray name="getData"
component={this.getData}
/>
getData= ({ fields, meta: { error, submitFailed } }) => {
let fetchFields = fields.getAll();
let displayFetchedFields = fetchFields.slice(0, this.state.pageNo);
if (displayFetchedFields) {
return displayFetchedFields.map((facility, index) => {
}
}}
点击加载更多错误之后:get.js:63 Uncaught TypeError:无法读取未定义的属性“字段”