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

后端 未结 6 1646
梦如初夏
梦如初夏 2020-12-16 02:07

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 condi

6条回答
  •  不思量自难忘°
    2020-12-16 02:29

    Don't use redux-promise. It overcomplicates something that's actually super simple to do yourself.

    Instead read the redux docs: http://redux.js.org/docs/advanced/AsyncActions.html

    It'll give you a much better understanding of how to handle this kind of interactions and you'll learn how to write something (better than) redux-promise yourself.

提交回复
热议问题