Avoid Accidental Returns of New State by using the void Keyword

Share this video with your friends

Send Tweet

A small caveat with Immer is that arrow functions that consist of just an expression, and not a function block, always return a value.

In this lesson we will show that in these cases the void keyword can be used to avoid accidentally returning new state in addition to modifying the draft.