0

My initial state is,

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

In My reducer, since I have defined the nested structure for page,

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

works fine.

Since I haven't defined the nested structure for current or meta

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

throws an error 'Invalid keypath'

When I logged the state,

{
   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
}
Kamalakannan J
  • 2,818
  • 3
  • 23
  • 51

1 Answers1

0

You should be able to use the mergeIn method in your case as per the following documentation: http://facebook.github.io/immutable-js/docs/#/Map/mergeIn.

Hope it helps!

Aibu
  • 401
  • 5
  • 10