contianer 组件
connect([mapStateToProps], [mapDispatchToProps], [mergeProps], [options])(Component)const mapStateToProps = state => ({
page: selector.getPage(state)
});
const mapDispatchToProps = dispatch => ({
deleteDiscount(page, lineId) {
dispatch(asyncAction.deleteDiscount(page, lineId));
}
});
const mergeProps = (stateProps, dispatchProps, ownProps) => {
return Object.assign({}, ownProps, stateProps, dispatchProps, {
deleteDiscount: dispatchProps.deleteDiscount.bind(null, stateProps.page)
});
};
export default connect(mapStateToProps, mapDispatchToProps, mergeProps)(Table);Last updated