如何在redux形式的cancel上更新redux先前状态的状态?

时间:2019-11-27 06:53:26

标签: reactjs react-redux redux-form cancel-button redux-form-validators

在以redux形式取消时,如何在redux中更新先前状态?

case LOAD_CHANGE_TYPE_LIST:
            if(state.changeTypeList.indexOf(action.data) !== -1) {
                return {...state, changeTypeList: state.changeTypeList}
            }
            return {...state, changeTypeList: [...state.changeTypeList, action.data]}



export function getscnBackup() {
    return (dispatch, getState) => {
        let {info: {Info}, InfoBackup} = getState().Scn;
        let temp = {};
        temp.Description = InfoBackup.Description
        temp.TimeShipDt = InfoBackup.TimeShipDt
        temp.Reason = InfoBackup.Reason
        temp.SentDt = InfoBackup.SentDt
        temp.Nature = InfoBackup.Nature
        temp.ReslvDt = InfoBackup.ReslvDt
        temp.Comment = InfoBackup.Comment
        Info = {...Info, ...temp}
        dispatch({ type: LOAD_JPN_INFORMATION, data: { Info: Info } });
        if(InfoBackup.changeTypeList && InfoBackup.changeTypeList.length) {
            for(let i = 0; i < InfoBackup.changeTypeList.length; i++) {
                dispatch({ type: LOAD_CHANGE_TYPE_LIST, data: InfoBackup.changeTypeList[i].chgTypCode});
            }
        }
    }
 }

I have saved all the values of form in an object and sending the previous state value to redux to update the state again ,all the values are updating except type of change(drop down list )

在以redux形式取消时,如何在redux中更新先前状态?

0 个答案:

没有答案