Search code examples
redux-saga

Using redux-saga as middleware, which is more useful in both All effect and Fork effect used in root saga file


https://redux-saga.js.org/docs/advanced/RootSaga

I read the documentation of rootSaga from the above mentioned link, but I am not able to find which approach is more useful for and in which cases or conditions.

Thanks for the help.


Solution

  • It mostly comes down to personal preference. All the options mentioned in the docs will work well, if all you are doing is running additional sagas.

    The only thing you need to consider is if your effects should be blocking or not - especially if there is some additional code in the saga. For that reason I'd suggest to use explicitly fork or call rather running generators by directly yielding them, even when nested within the all effect.