Immutable Data With Immer Using immutable data structures provides many benefits, including making your code easier to reason about and less prone to bugs.
WHY ● Immutable objects are simpler to construct, test, and use ● Truly immutable objects are always thread-safe ● They help to avoid temporal coupling ● Their usage is side-effect free
● Proxy root ● Lazily create proxy when a field is dereferenced ● Upon write, create shallow clone ● Upon finish, combine clones, freeze the modified objects
● Immutability with normal JavaScript objects, arrays, Sets and Maps. No new APIs to learn! ● Strongly typed, no string based paths selectors etc. ● Structural sharing out of the box ● Object freezing out of the box ● Deep updates are a breeze ● Boilerplate reduction. Less noise, more concise code. ● First class support for patches ● Small size 6kb Benefits