Adding the side-effect
Without side-effect, asynchronous routine will be triggered by reducer.
For the sake of managment, reusability and performance, such routine should be executed in parallel with the state change handled by reducers
Thus we are seeking for a solution that
- is portable
- is ready for unit test
- perform side-effect
- maintains its workflow
- can listen to multiple actions for multiple times like a state machine
Saga can help.
Design principle
To design SAGA, one of the prerequisite is learning how to draw a DFD, data flow diagram.