# redux-promise-middleware

> Enables simple, yet robust handling of async action creators in Redux

Latest version **6.2.0** (published 2023-12-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install redux-promise-middleware
pnpm add redux-promise-middleware
yarn add redux-promise-middleware
bun add redux-promise-middleware
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 6.2.0 |
| Published | 2023-12-27 |
| First published | 2015-07-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 61 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1967 |
| Author | Patrick Burtchaell |
| Maintainers | pburtchaell |
| Keywords | redux, middleware, middlewares, promise, promises, optimistic update, optimistic updates, async, async functions |

## Links

- npm: https://www.npmjs.com/package/redux-promise-middleware
- Repository: https://github.com/pburtchaell/redux-promise-middleware
- Issues: https://github.com/pburtchaell/redux-promise-middleware/issues
- npm.io page: https://npm.io/package/redux-promise-middleware

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 6.2.0 (latest) — 2023-12-27
- 6.0.1-beta.0 (beta) — 2019-02-06
- 2.5.0 (prev) — 2017-04-16
- 6.1.3 — 2022-09-26
- 6.1.2 — 2019-11-05
- 6.1.1 — 2019-06-15
- 6.1.0 — 2019-02-14
- 6.0.1 — 2019-02-07
- 6.0.0 — 2019-02-03
- 6.0.0-beta.0 — 2019-01-27
- 5.1.1 — 2018-04-18
- 5.1.0 — 2018-04-18
- 5.0.0 — 2017-11-19
- 4.4.2 — 2017-11-02
- 4.4.1 — 2017-08-27
- … 34 more at https://npm.io/package/redux-promise-middleware/versions

## README

# Redux Promise Middleware

[![npm downloads](https://img.shields.io/npm/dm/redux-promise-middleware.svg?style=flat)](https://www.npmjs.com/package/redux-promise-middleware)

Redux Promise Middleware enables simple, yet robust handling of async action creators in [Redux](http://redux.js.org). 

```js
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](https://github.com/gaearon/redux-thunk) to chain action creators.

```js
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
- [Introduction](/docs/introduction.md)
- [Guides](/docs/guides/)
- [Examples](/examples)

**Heads Up:** Version 6 includes some breaking changes. Check the [upgrading guide](docs/upgrading/v6.md) for help.

## Issues
For bug reports and feature requests, [file an issue on GitHub](https://github.com/pburtchaell/redux-promise-middleware/issues/new).

For help, [ask a question on StackOverflow](https://stackoverflow.com/questions/tagged/redux-promise-middleware).

## Releases
- [Release History](https://github.com/pburtchaell/redux-promise-middleware/releases)
- [Upgrade from 5.x to 6.0.0](docs/upgrading/v6.md)
- [Upgrade from 4.x to 5.0.0](docs/upgrading/v5.md)
- [Upgrade from 3.x to 4.0.0](docs/upgrading/v4.md)

For older versions:
- [5.x](https://github.com/pburtchaell/redux-promise-middleware/tree/5.1.1)
- [4.x](https://github.com/pburtchaell/redux-promise-middleware/tree/4.4.0)
- [3.x](https://github.com/pburtchaell/redux-promise-middleware/tree/3.3.0)
- [2.x](https://github.com/pburtchaell/redux-promise-middleware/tree/2.4.0)
- [1.x](https://github.com/pburtchaell/redux-promise-middleware/tree/1.0.0)

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

Patrick Burtchaell (pburtchaell):
- [GitHub](https://github.com/pburtchaell)

Thomas Hudspith-Tatham (tomatau):
- [GitHub](https://github.com/tomatau)

## License

[Code licensed with the MIT License (MIT)](/LICENSE). 

[Documentation licensed with the CC BY-NC License](https://creativecommons.org/licenses/by-nc/4.0/).

---
_Source: https://npm.io/package/redux-promise-middleware · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
