Reducers must be:
- pure: pure reducer does not mutate the state directly.
- side-effect free: reducer does not change a non-local state, nor use an external code. ex) console.log()
- synchronous: reducer does not "await" for asynchronous results. ex) HTTP request
If side-effects & async tasks are necessary,
- Use them inside components: via useEffect.
- Use action creators.
Top comments (0)