Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Allow update to take a reducer.
A reducer is a function that takes the state and returns a new state or a reducer. update(state => { return { value: state.value + 1 } } This allows you to get the current & latest state inside the callback of some async call. The alternative is using the state that was passed to the action that originated the async call. The problem is that this reference to the state may have gone out-of-date if other actions run and finished during the async process and changed the state.
- Loading branch information