I have thought about the structure of saga and comed up with an approach, but don't know if it is correct or not.
For example, I have multiple saga files, and for each typical saga file, there is one watcher saga watches different actions "concurrently", And then we only need to export this watcher saga as default.
Here is my tentative approach:
I am not sure abot the way I group the watcher sagas
/**
* saga.js
*
* one watcher saga watch multiple actions concurrently
* However, from my research, I can only see that everyone seems to create
* multiple watcher sagas, and each watcher only watch single action which is
* sort of verbose
*/
function* watchSomething() {
yield all([
takeLatest(GET_SOMETHING, callGetSomething),
takeLatest(GET_SOMETHING_2, callGetSomething_2),
takeLatest(GET_SOMETHING_3, callGetSomething_3),
]);
}
export default watchSomething;
And
/**
* rootSaga.js
*
* import different watcher sagas from different saga.js files
*/
export default function* root() {
yield all([
watchSomething(),
watchSomething_2(), // the others ...
]);
};