![]() Sagas are implemented using generator functions (a new ES2015 feature). It's sufficient to know that a saga is a piece of code which runs in the background, watch for dispatched actions, may perform some async calls (or synchronous impure calls like browser storage) and can dispatch other actions to the store. But in redux-saga, The closest meaning is actually a process manager basically: "a process that receive events, and may emit new events (sync or async), aiming to orchestrate complex workflows inside your application" (kudos to want to emphasize that you don't actually have to go through academic papers and backend concepts in order to use redux-saga. The term saga was historically used by Hector Garcia-Molina and Kenneth Salem to define a mechanism to handle long lived transactions in database systems. ![]() The redux-saga middleware isolates all side effects into software artifacts called sagas so that side effects can be managed. In functional programming (FP) jargon we commonly refer to those things as side effects. But in real applications we need also to do things that are asynchronous (may not complete immediately like an AJAX request) and impure (change the state of the outside world, like saving to a database). Without middleware, all we can do in Redux is compute a new state from the previous state and a given action through reducers which are pure functions.Īll the handling inside reducers is synchronous and pure. Redux is an opinionated library for managing the state of an application. Redux middleware is an add-on you plug into Redux to get additional features. It is a Redux middleware for handling side effects. How would you describe redux-saga to someone who has never heard of it? # I hack things for myself, my company and occasionally others. Graduated? Nope (well yes and no, I'm graduated in Finances not in CS). I have a lot of passion for coding and learning and hacking new things, exploring new ideas. I live in Tangier (Morocco) and work on a real estate company. My name is Yassine Elouafi, 39 old and Dad for 2 kids. Check out the earlier interview about Redux if you haven't dug into Redux just yet. ![]() Read on to learn more about sagas and redux-saga in particular. Yassine Elouafi's redux-saga provides one solution to this problem. When developing front-ends, handling asynchronous behavior is always bit of a challenge.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |