【发布时间】:2017-09-28 04:21:40
【问题描述】:
我正在尝试从减速器中获取商店。 我看到 redux 架构不支持 reducer 之间的共享。 但在我的情况下确实需要它。
const initState = {
schemas: [],
};
const myReducer = (state , action) => {
state = state || initState;
switch (action.type) {
case 'redux-form/CHANGE':
const schemaId = getStore().context.schema;
let modifier = state.schemas.get(schemaId);
modifier[action.key] = action.value;
return {
...state
};
}
};
我的应用程序缩减器:
const iceApp = combineReducers({
form: formReducer,
context,
myReducer,
});
谢谢。
【问题讨论】:
标签: reactjs react-redux redux-thunk