0

我的初始状态是,

export const initialState = fromJS({
  current: {},
  page: {
    loading: false,
    isFirstLoaded: false,
  },
  meta: {},
});

在我的减速器中,因为我已经定义了嵌套结构page

state.setIn(['page', 'loading'], true);

工作正常。

由于我没有为currentor定义嵌套结构meta

state.setIn(['current', 'status'], 'done')

引发错误“无效的密钥路径”

当我记录状态时,

{
   current: {..with properties including status is there as object..},
   page: Map, // <--- why this alone being as Immutable Map,
   meta: {}, // <--- This is also being as plain object
}
4

1 回答 1

0

您应该能够mergeIn根据以下文档在您的案例中使用该方法:http: //facebook.github.io/immutable-js/docs/#/Map/mergeIn

希望能帮助到你!

于 2018-07-11T07:53:54.300 回答