redux-promise

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

我的未来我决定 提交于 2020-01-02 04:56:29
问题 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 now need to pass another information with it like so return { order: 0, // New field type: STORY_ACTIONS.STORY_SPOTIFY_REQUEST, payload: request } This results in an unresolved promise instead of data. I tried renaming order to something like position or index ... still

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

99封情书 提交于 2019-12-18 03:32:58
问题 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 deal with error condition when using axios w/ reduc-promise (middleware).. here is the gist of what i have.. in action/ const request = axios(SOME_URL); return { type: GET_ME_STUFF, payload: request } in reducer/ const startState = { whatever: [],

Redux middleware design re: return values

拥有回忆 提交于 2019-12-07 00:37:23
问题 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 (i.e. logging ) doesn't - and simply returns the result of next(action) . My issue is what happens if I want to use two pieces of middleware that both return stuff - surely they will clobber each other and I will only get the outer-most middleware

Redux middleware design re: return values

不想你离开。 提交于 2019-12-05 05:56:57
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 (i.e. logging ) doesn't - and simply returns the result of next(action) . My issue is what happens if I want to use two pieces of middleware that both return stuff - surely they will clobber each other and I will only get the outer-most middleware's return value. express/connect middleware addresses this by letting middleware write its "results" to

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

隐身守侯 提交于 2019-11-27 16:51:28
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 mechanism as Action throws an exception of dispatching only plain objects. What is the major differences between these two packages? Are there any benefits of using both the packages in a single page react app or sticking to redux-thunk would be enough? redux-thunk allows your action creators to return a function : function myAction(payload){ return

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

安稳与你 提交于 2019-11-26 18:46:27
问题 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 mechanism as Action throws an exception of dispatching only plain objects. What is the major differences between these two packages? Are there any benefits of using both the packages in a single page react app or sticking to redux-thunk would be