There is a slight discrepancy between what you set as the initial state of the store and what you tell the store to expect what the initial state of the store should be, for example. - update the initial state for the repository as such:
const initialState = { marvel: { characters: [] } };
And it's also nice to name state tree variable holders by meaningful names that don't have a reducer in them, so update
const rootReducer = combineReducers({ marvelReducer, routing: routerReducer });
to
const rootReducer = combineReducers({ marvel: marvelReducer, routing: routerReducer });
And that should do the trick for you.
Hope this helps,
PS. some documents.
From the docs :
If you created a reducer with combReducers, it should be a simple object with the same shape as the keys passed to it. Otherwise, you can transfer everything your gearbox can understand.
If you donβt need to handle any actions related to one or two , just pull them out initially, it can be as simple as
export default combineReducers({ events, flash, one: (state = {}) => state, two: (state = {}) => state })
Elod szopos
source share