Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Both redux-thunk and redux-promise are middleware libraries for Redux that allow actions to return async actions rather than just objects. However, there are some key differences between the two:

  1. Action Shape: redux-promise expects actions to have a "payload" property that is a promise, whereas redux-thunk expects actions to be functions that return a promise.

  2. Control Flow: redux-promise automatically dispatches actions after the promise has been resolved or rejected, whereas with redux-thunk, the developer can choose when to dispatch the action and how to handle success or failure.

  3. Middleware Control: redux-promise is a simple one-liner middleware function, whereas redux-thunk requires additional configuration to integrate into the Redux store.

  4. Customizability: redux-thunk is more flexible in terms of allowing developers to customize their async logic and handle side effects more explicitly. In contrast, redux-promise has a more opinionated approach to handling async actions.