Skip to content
Enables simple, yet robust handling of async action creators in Redux
JavaScript
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Delete FUNDING.yml Jul 6, 2019
docs Fix the example (#254) Jul 12, 2019
examples Release Version 6 (#231) Feb 3, 2019
src Update upgrade guide URL (#252) Jun 11, 2019
test Release Version 6 (#231) Feb 3, 2019
.babelrc Refactor Tests and Switch to babel-preset-env (#221) Nov 18, 2018
.eslintrc Refactor Tests and Switch to babel-preset-env (#221) Nov 18, 2018
.gitattributes Implement Parcel (#217) Jul 7, 2018
.gitbook.yml Add Gitbook (#213) May 1, 2018
.gitignore Reorder gitignore and npmignore Oct 8, 2017
.npmignore Fix npmignore for TS definitions (#237) Feb 7, 2019
.travis.yml Implement Parcel (#217) Jul 7, 2018
LICENSE Add line breaks Sep 26, 2016
README.md
package-lock.json Release Version 6 (#231) Feb 3, 2019
package.json Release version 6.1.1 Jun 15, 2019
webpack.config.js Implement Parcel (#217) Jul 7, 2018

README.md

Redux Promise Middleware

Build Status npm downloads

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

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 Redux Thunk 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

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

Issues

For bug reports and feature requests, file an issue on GitHub.

For help, ask a question on StackOverflow.

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

Code licensed with the MIT License (MIT).

Documentation licensed with the CC BY-NC License.

You can’t perform that action at this time.