score:-1

Generator functions are more flexible and can be used for yielding different things depending on the number of times it gets used. Pagination of some sort comes to my mind. Here are some examples of generator functions that would be trickier to implement using async/await:

https://github.com/getify/You-Dont-Know-JS/blob/master/async%20%26%20performance/ch4.md#multiple-iterators

score:1

'yield' will wait until generator is unrolled to this 'yield' iteration.

The idea of saga generator (worker) is to generate special functions (so called 'effects') using effect creators (put, call etc), not just do something. This allows to orchestrate function calls.

See also Redux Saga async/await pattern


Related Query

More Query from same tag