Redux saga: internals of how redux-saga works

Viewed 1010

I know that a redux middleware sits between an action getting dispatched and reducer getting called. Understanding redux-thunk was easy compared to redux-saga. I understand generators and how they are being used to write code that depends on async calls to be written as if code is synchronous. I also know that generator becomes a consumer in this model. Generator yields instructions to redux-saga middleware. Middleware handles the request and gives back result. What I don't get is how saga middleware is possible in a single threaded execution. Also why we call run root saga method? Is it a setup method or does it really start running sagas? Since we can dispatch actions from sagas by using put effect, does it take the whole execution back to where middleware started. Can someone clarify how the whole handling of saga happen?

0 Answers
Related