![]() ![]() Contrary to redux thunk, you don't end up in callback hell, you can test your asynchronous flows easily and your actions stay pure. ![]() You might've used redux-thunk before to handle your data fetching. (kind of like async/ await, but generators have a few more awesome features we need) (if you're not familiar with them here are some introductory links) By doing so, these asynchronous flows look like your standard synchronous JavaScript code. ![]() It uses an ES6 feature called Generators to make those asynchronous flows easy to read, write and test. redux-saga is a redux middleware, which means this thread can be started, paused and cancelled from the main application with normal redux actions, it has access to the full redux application state and it can dispatch redux actions as well. The mental model is that a saga is like a separate thread in your application that's solely responsible for side effects. asynchronous things like data fetching and impure things like accessing the browser cache) easier to manage, more efficient to execute, easy to test, and better at handling failures. Redux-saga is a library that aims to make application side effects (i.e. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
June 2023
Categories |