Immutable.js Push into array in nested object

I'm using seamless-immutable, when I'm adding a new item to array of nested object, I got this error:

The push method cannot be invoked on an Immutable data structure.

My array still has push method, but it doesn't work. The solution is use concat instead, more details on #43:

initialState.updateIn(['foo', 'bar'], arr => arr.concat([4]));

Hope this help!


This should work

initialState.updateIn(['foo', 'bar'], arr => arr.push(4))

References:

  • https://immutable-js.github.io/immutable-js/docs/#/updateIn