dueDate
property:updateDueDate
action handler:patch
operator will become your best friend in case of choosing state operators as your immutability helpers. Let's see how we could re-write the above code with the help of the patch
state operator:immer
is a very popular library that allows you to make changes to immutable objects as if they were mutable. The below code shows how to write the same code with the help of Immer:produce
function can be also used as a state operator:immer
repository:Using Immer is like having a personal assistant; he takes a letter (the current state) and gives you a copy (draft) to jot changes onto. Once you are done, the assistant will take your draft and produce the real immutable, final letter for you (the next state).
immutability-helper
is a small package that lets you mutate a copy of data without changing the original source:object-path-immutable
is a small library that allows you to modify deep object properties without modifying the original object. Let's look at how we could write the same code using this library:immutable-assign
is a lightweight library that pursues the same goal. Its syntax is similar to immer
's:icepick
is a zero-dependency library for working with immutable collections. Given the following re-written code: