Course lesson

Avoid Accidental Returns of New State by using the void Keyword

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

Duration
2 min
Access
Pro
Transcript
Available

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.