immutable.js “invalid” setIn behavior
const { fromJS } = require('immutable@4.0.0-rc.12');
const original = fromJS({
foo: {
items: ['zero', 'one', 'two'],
},
});
let modified = original.setIn(['foo', 'items', 2], 'dos');
console.log(modified);
modified = modified.setIn(['foo', 'bar'], 'snickers');
console.log(modified);
modified = modified.setIn(['foo', 'items', 'baz'], 'qux'); // this update is ignored
console.log('final:', modified);
no comments