Using this code, I was getting the 'state.forEach' is not a function error. Now, I seem to get 'state.has' is not a function error. I assume these errors are related to having immutablejs just on substate instead of the full state. I verified that using a single state works. What is the magic to get multiple substates to work? Thanks.
// combine initial state here; or set as default value on reducer which will be loaded when the reducer is
const combinedInitialState = {
subStateA: fromJS(subStateBInitialData),
subStateB: fromJS(subStateBInitialData)
};
const store = createStore(combinedReducers, combinedInitialState, composeEnhancers(middleware, autoRehydrate()));
Using this code, I was getting the 'state.forEach' is not a function error. Now, I seem to get 'state.has' is not a function error. I assume these errors are related to having immutablejs just on substate instead of the full state. I verified that using a single state works. What is the magic to get multiple substates to work? Thanks.
const combinedReducers = combineReducers( { subStateA: stateAReducer, subStateB: stateBReducer } );
// combine initial state here; or set as default value on reducer which will be loaded when the reducer is const combinedInitialState = { subStateA: fromJS(subStateBInitialData), subStateB: fromJS(subStateBInitialData) };
const store = createStore(combinedReducers, combinedInitialState, composeEnhancers(middleware, autoRehydrate()));
persistStore(store);