As you know, when working with immutable objects you often get to what’s called a “spread hell” situations. If you prefer working with immutable objects in an mutable fashion, you can use immer with Akita.
The only thing you need to do is pass the
produce function from
immer to your store:
Now when you use the store's
update function, you'll get the
draft version, which you can mutate:
When you choose to work with
immer, you can't return a new value from the callback function:
This will cause
immer to throw. Here's a live example you can play with.