Questions tagged [redux-promise]

48 questions
103
votes
3 answers

What is the difference between redux-thunk and redux-promise?

As far as I know and correct me if I am wrong, redux-thunk is a middleware which helps us dispatch async function and debug values in the action itself while when I used redux-promise I couldn't create async functions without implementing my own…
shet_tayyy
  • 5,366
  • 11
  • 44
  • 82
15
votes
1 answer

What are the differences between Redux-Thunk and Redux-Promise when used with Axios apis?

I have been using React , Redux since few months now. One of the most confusing part of the ecosystem is the async data flow. There are many great solutions available and choosing the right solution for your problem is the tough part. In my…
Dishant Soni
  • 153
  • 1
  • 5
10
votes
2 answers

Redux-Thunk - Async action creators Promise and chaining not working

I am trying to dispatch an action. I found working examples for some actions, but not as complex as mine. Would you give me a hint? What am I doing wrong? I am using TypeScript and have recently removed all typings and simplified my code as much as…
dazlious
  • 546
  • 6
  • 23
10
votes
3 answers

Redux middleware design re: return values

So I've just read up on redux middleware, and it sounds great. One thing is bugging me though - the return values of the middleware. I understand that some instances of middleware return stuff (i.e. redux-promise) , and I get that other middleware…
maambmb
  • 881
  • 1
  • 8
  • 18
10
votes
6 answers

redux-promise with Axios, and how do deal with errors?

So, I see on an error, redux-promise hands me back error: true, along with the payload, but that is once it hits the reducer... to me, decoupling the request AND error condition is a bit odd, and seems inappropriate. What is an effective way to also…
james emanon
  • 11,185
  • 11
  • 56
  • 97
9
votes
3 answers

What is the point of Redux Promise and Redux Promise Middleware?

I've searched high and low but can't find a clear answer. I've managed to wrap my head around the mechanics of Redux, but when I've come to the point of API calls and async action creators, I'm stuck with middleware in context of Promises. Can you…
Joey
  • 409
  • 1
  • 3
  • 11
7
votes
2 answers

Why would I use Redux Promise Middleware over Redux Promise?

I've used Redux Promise, but it seems Redux Promise Middleware has more functionality like dispatching multiple actions with "PENDING" or "FULFILLED" appended. Why would I use one over the other?
user4703365
7
votes
2 answers

chaining redux-actions and redux-promise-middleware

I use redux-actions and redux-promise-middleware to dispatch actions, along with TypeScript 2.1 for async await support. This is an action using both redux-actions and redux-promise-middleware // create an async action const fooAction =…
Rajab Shakirov
  • 7,265
  • 7
  • 28
  • 42
5
votes
3 answers

React Redux adding extra field for action cause promise to return differently

I want to add a isLoading flag to my action generator and reset it at my reducer. Initially without the flag, my code works and the action looks like the following export function getList() { const FIELD = '/comics' let searchUrl = ROOT_URL…
ErnieKev
  • 2,831
  • 5
  • 21
  • 35
5
votes
1 answer

Where should I Compose Complex Asynchronous Flows in Redux?

I want to model the following async logic using redux: User action triggers a chain of async API calls. Any API call might return 401 status (login timed out) If API responds with 401, display re-login popup On successful re-login, reissue API call…
timoxley
  • 5,156
  • 3
  • 36
  • 40
5
votes
1 answer

Reject previous route's pending action upon page transition in Redux app

I have Redux app with React Router (based on https://github.com/este/este). Inside one Route, there may be more than 1 AJAX calls (fired by redux-promise-middleware & redux-thunk). When the page changes (via react-router) I wish to reject all…
5
votes
1 answer

Why does Redux Promise return unresolved promise if more than type and payload options are specified?

I'm having tough time figuring out why this is happening, but essentially Redux Promise was working fine for me while returning something like: return { type: STORY_ACTIONS.STORY_SPOTIFY_REQUEST, payload: request } However, I…
Ilja
  • 44,142
  • 92
  • 275
  • 498
4
votes
2 answers

Reducer returns undefined when using redux-promise and axios

I'm having this issue when I'm trying to invoke a callback after the promise resolves (using .then) It turns out that this gives my const request some kind of different promise that reducer returns as undefined: action: export function…
4
votes
3 answers

redux-promise: Uncaught TypeError: middleware is not a function

I am building a webpage with react. I used a tutorial from udemy where the author used redux promise for rest calls. It worked in the course. In my own project, I set up everything the same and when I try to create the store with the redux-promise…
nsoeth
  • 371
  • 2
  • 5
  • 17
4
votes
1 answer

How to get a resolved promise to my component with Redux Promise?

I'm making a request in my action - pulling from an API that needs to load in some data into my component. I have it start that request when the component will mount, but I can't seem to get Redux-Promise to work correctly because it just keeps…
dace
  • 5,819
  • 13
  • 44
  • 74
1
2 3 4