我正在公司应用程序中删除immutable.js,我想拥有单独的reducer,可以用来引用我的代码库中已经迁移过的那一部分。
我找到了上一篇How can I combine multiple combineReducers functions in Redux using something like immutable.js
但是我可能无法成功实现这一目标,可能是因为两者之间并不完全兼容。
const immutableReducersCombined = combineReducersImmutable({
...
});
const migratedCombineReducer = combineReducers({
...
});
export default (state, action) => (
migratedCombineReducer(immutableReducersCombined(state, action), action)
);
导致以下错误。我不知道您是否遇到过类似的问题以及如何解决?
warning.js:10 The previous state received by the reducer has
unexpected type of "Object". Expected argument to be an object with
the following keys: "pndStatementFiles"
warning @ warning.js:10
combination @ combineReducers.js:110
_default @ reducer.js:67
computeNextEntry @ VM73425:1
recomputeStates @ VM73425:1
(anonymous) @ VM73425:1
dispatch @ createStore.js:165
createStore @ createStore.js:240
(anonymous) @ VM73425:1
(anonymous) @ VM73425:1
(anonymous) @ VM73425:1
(anonymous) @ applyMiddleware.js:28
(anonymous) @ VM73425:1
createStore @ createStore.js:51
_default @ createStore.js:12
./src/index.tsx @ index.tsx:25
__webpack_require__ @ bootstrap:724
fn @ bootstrap:101
0 @ transformers.js:10
__webpack_require__ @ bootstrap:724
./node_modules/ansi-html/index.js.module.exports @ bootstrap:791
(.anonymous) @ bootstrap:791
15:01:54.795
注意:为了使您了解当前情况,我正在使用选择器进行解决:
const myModuleStateSelector = state => state.get('myModule')
const getEmployeeSelector= createSelector(
myModuleStateSelector,
(myModuleState) => myModuleState.employee
);
但是我想知道是否有更好的解决方案