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

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


Redux Promise is convenient for dispatching three actions (request, success, failure) without writing that code manually.

Redux Thunk is convenient for async data flow when you express one action creator as waiting for another action creator. It also lets you read the current state for conditional dispatches and early bailouts.

You can use them together, or use any one in particular. I would recommend starting with Redux Thunk because it offers more control and is more versatile. After you get it working, you can consider adding Redux Promise to remove some of the boilerplate code related to dispatching three kinds of actions. If you find that it doesn’t buy you much, remove it. On the other hand, if you notice all you thunk action creators just dispatch a single promise, you can remove Redux Thunk instead.

If this is still confusing, I recommend just using Redux Thunk until you get more comfortable with how middleware works.