What if we wanted to optimistically add/toggle our todos before the server API call returns?
ConanJs allows you to add optimistic updates to your state. In order to achieve this, it provides State monitor and asyncMerge. As you will see, the monitor also allows us to cancel ongoing async calls, and update our local state accordingly.
Adding the state
We need to slightly modify our Todo definition to make it optimistically updatable. It just needs to hold a status per todo item: