Skip to content

Tag: redux-saga

How to wait for another action in redux-saga

I have a few sagas that may finish and then put another action into the store. Some sagas should only execute after others are executed: they must block, or wait until another one is finished. Summarized as follows: I’m trying to maintain as little coupling between sagas, so bonus points for showing me a way to achieve this outside of

How to handle errors in fetch() responses with Redux-Saga?

I try to handle Unauthorized error from server using redux-saga. This is my saga: I fetch data like this: But anyway result is {type: ‘LOG_IN_SUCCEEDED’, user: undefined} when I expect {type: ‘LOG_IN_FAILED’, error: ‘Unauthorized’}. Where is my mistake? How to handle errors right using Redux-Saga? Answer Don’t handle the then and error in your fetchUser method and your saga. Since

Pros/cons of using redux-saga with ES6 generators vs redux-thunk with ES2017 async/await

There is a lot of talk about the latest kid in redux town right now, redux-saga/redux-saga. It uses generator functions for listening to/dispatching actions. Before I wrap my head around it, I would like to know the pros/cons of using redux-saga instead of the approach below where I’m using redux-thunk with async/await. A component might look like this, dispatch actions