3 ms·
I use redux and react-saga for more complex flows, sagas translate into generators and make async code flows look almost like synchronous code which is nice.
by concerned_user 7y ago
I use redux and react-saga for more complex flows, sagas translate into generators and make async code flows look almost like synchronous code which is nice.
- machiaweliczny 7y agoSagas are nice to read but hard to test. IMO simpler async functions are enough. Is there any benefit to sagas that I don't see?
- acemarke 7y agoSagas are a great power tool... and 95% of Redux apps don't actually need them. Using them just for basic data fetching is overkill. Sagas are most useful when you need to do complex async logic, like cancellation, debouncing, and decoupled "background-thread"-like computations. Thunks are sufficient for most use cases, but the main thing they can't do is respond to dispatched actions. For more info, see the Redux FAQ entry on choosing an async middleware: https://redux.js.org/faq/actions#what-async-middleware-should-i-use-how-do-you-decide-between-thunks-sagas-observables-or-something-else https://redux.js.org/faq/actions#what-async-middleware-shoul...