猿问

combineReducers拆分后不同的Reducers状态不共享吗?

当我写了ReducerA和ReducerB后,使用combineReducers


const rootReducer = combineReducers({

    ReducerA,

    ReducerB

});


export default rootReducer;

状态就变成了


state:{

    ReducerA:...,

    ReducerB:...

}

相对应的ActionA和ActionB也就只能通过对应的Reducer更改对应的state部分


ActionA → state:{ReducerA:...}


ActionB → state:{ReducerB:...}

应该是这样的吗?有办法通过ActionB去影响state:{ReducerA:...}的内容吗?


慕仙森
浏览 626回答 2
2回答

MYYA

其实更改state是由action里面大的type控制的啊,只要type对应好了,想改哪个都行啊
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答