我正在使用 react-redux 进行 api 调用。问题是如何在保存/插入新行时执行操作后获得操作的结果
class AddServiceForm extends Component {
handleSaveBtnClick = () => {
const { columns, onSave } = this.props;
let params = new URLSearchParams();
this.props.addServices(params) // i need to find out result of this action???
};
render() {
const {
onModalClose,
onSave,
columns,
validateState,
ignoreEditable
} = this.props;
//const { columns, validateState } = this.props;
return (
<div className="modal-content">
//modal form
</div>
);
}
}
function mapStateToProps(state) {
return {
servicesAdd: state.servicesAdd
};
}
function mapDispatchToProps(dispatch) {
return bindActionCreators(
{ addServices },
dispatch
);
}
代码在线https://codesandbox.io/s/o5430k7p4z并且有问题的文件是components/services/index.js