Updating nested values with ImmutableJS
The key to being productive with Immutable JS is understanding how to update values that are nested. Using
setIn you can place a new value directly into an existing or new path. If you need access to the previous value before setting the new one, you can use
updateIn accepts the same path lookups as
setIn, but gives you a callback function instead so that you can use the previous value however you wish and return an updated version.