How can I set a deeply nested value in Immutable.js?
Maps in Immutable have a setIn method that makes it easy to set deep values:
peopleImmutable = peopleImmutable.setIn(["Thomas", "nickname"], "Mr. T");
Or, using split
to generate the array:
peopleImmutable = peopleImmutable.setIn("Thomas.nickname".split("."), "Mr. T");