我似乎无法从reducer更新redux存储。状态是immutable.js记录,在图像中打印得很漂亮。
此减速器运行:
const searchResultsMapRegion = (state = vepo, action) => {
switch (action.type) {
case 'UPDATE_SEARCH_PAGE_RESULTS_PAGE_MAP_REGION': {
console.log(state.toJS())
const newState = state.set('some', 555)
console.log(newState.toJS())
return newState
}
default:
return state
}
}
const rootReducer = combineReducers({
product: product,
searchResultsMapRegion: searchResultsMapRegion
})
export const rootEpic = combineEpics(
fetchCategoriesEpic,
getUserPositionEpic,
getUserLocationEpic,
getUserLocationFulfilledEpic
)
export const store = createStore(
rootReducer,
vepo,
composeWithDevTools(applyMiddleware(createEpicMiddleware(rootEpic)))
)
我有其他减速器作用于该州的product
部分并且它们工作正常。为什么我不能在问题中显示的州some
部分采取行动?
减速器顶部的state
的console.log:
newState
的console.log
减速器完成运行后, state
的console.log:
答案 0 :(得分:0)
重新检查案例类型。这是指正确的案例值吗?此外,需要从createStore中删除vepo。
export const store = createStore(
rootReducer,
vepo,
composeWithDevTools(applyMiddleware(createEpicMiddleware(rootEpic)))
)