💫
Promise Middleware
  • Introduction
  • Getting Started
    • Introduction
    • Design Principles
  • Guides
    • Catching Errors Thrown by Rejected Promises
    • Chaining Actions
    • Comparison to other promise middleware
    • Custom Type Delimiters
    • Custom Types
    • Optimistic Updates
    • Use with Async/Await
    • Use with Reducers
    • Use with Redux Actions
    • Use with Redux Promise Actions
    • Use with Promises Resolved with Null Values
  • Upgrade Guides
    • Upgrade from 5.x to 6.0.0
    • Upgrade from 4.x to 5.0.0
    • Upgrade from 3.x to 4.0.0
    • Release History
Powered by GitBook
On this page
  • Documentation and Help
  • Issues
  • Releases
  • Maintainers
  • License

Introduction

NextIntroduction

Last updated 5 years ago

Redux Promise Middleware enables simple, yet robust handling of async action creators in .

const asyncAction = () => ({
  type: 'PROMISE',
  payload: new Promise(...),
})

Given a single action with an async payload, the middleware transforms the action to a separate pending action and a separate fulfilled/rejected action, representing the states of the async action.

The middleware can be combined with to chain action creators.

const secondAction = (data) => ({
  type: 'SECOND',
  payload: {...},
})

const firstAction = () => {
  return (dispatch) => {
    const response = dispatch({
      type: 'FIRST',
      payload: new Promise(...),
    })

    response.then((data) => {
      dispatch(secondAction(data))
    })
  }
}

Documentation and Help

Issues

Releases

For older versions:

Maintainers

Please reach out to us if you have any questions or comments.

Patrick Burtchaell (pburtchaell):

Thomas Hudspith-Tatham (tomatau):

License

Heads Up: Version 6 includes some breaking changes. Check the for help.

For bug reports and feature requests, .

For help, .

.

.

Introduction
Guides
Examples
upgrading guide
file an issue on GitHub
ask a question on StackOverflow
Release History
Upgrade from 5.x to 6.0.0
Upgrade from 4.x to 5.0.0
Upgrade from 3.x to 4.0.0
5.x
4.x
3.x
2.x
1.x
Twitter
GitHub
GitHub
Code licensed with the MIT License (MIT)
Documentation licensed with the CC BY-NC License
Redux
Redux Thunk
Build Status
npm downloads