Immutable set merge 区别

Immutable
set 方法接受Immutable对象

const RegisterReducer = (state = initialState, action) => {
    if (action.type === GET_COUNTRYS) {
        return state.set('countryData',Immutable.fromJS(action.data))
    } else if (action.type === GET_PROMOTIONS) {
        return state.set('promotionData',Immutable.fromJS(action.data))
    }

    return state
}

merge 接受普通js对象

两者都接受基本数据类型

你可能感兴趣的:(Immutable set merge 区别)