我有一个enpoint,它获取formData,API只获取POST方法。当页面呈现时,它采用初始值,但我有另一种形式来更改参数,一旦我更改了参数,它就不会发送更新的值。
PS。在这里使用Redux创建切片是我的代码;
表单页面
parametersChange = form => {
…};
formatData = data => {
return form;
};
以及我的createSlice方法;
export const functionName = (data = {}) => (dispatch, getState) => {
........
}));
};
this.props.getLossAvoidanceList({...data }); };
This should update my createSlice Method, however, the datain my createSlice method is always returns undefined. Where am I doing wrong ?
const mapStateToProps = (state) => ({
.....
});
const mapDispatchToProps = {
...
};
export default connect(
....
)(withRouter(LossAvoidance));
我展示了您的代码,没有发现任何错误,但我认为问题在于HOC 的声明
试试
import { compose } from "redux";
export default compose(
withRouter,
connect(mapStateToProps, mapDispatchToProps)
)(LossAvoidance);