# redux-promise-middleware-global-action

> Redux middleware for promises, async functions and conditional optimistic updates

Latest version **5.0.1** (published 2018-03-12) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 5.0.1 |
| Published | 2018-03-12 |
| First published | 2018-03-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 814.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1968 |
| Author | Patrick Burtchaell |
| Maintainers | yanguoyu |
| Keywords | redux, middleware, middlewares, promise, promises, optimistic update, optimistic updates, async, async functions |

## Links

- npm: https://www.npmjs.com/package/redux-promise-middleware-global-action
- 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-global-action

## 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

- 5.0.1 (latest) — 2018-03-12

## README

# Redux Promise Middleware

[![npm version](https://img.shields.io/npm/v/redux-promise-middleware.svg?style=flat)](https://www.npmjs.com/package/redux-promise-middleware) [![Build Status](https://travis-ci.org/pburtchaell/redux-promise-middleware.svg?branch=master)](https://travis-ci.org/pburtchaell/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 robust handling of async action creators in [Redux](http://redux.js.org): it accepts a promise and dispatches pending, fulfilled and rejected actions.

```js
const promiseAction = () => ({
  type: 'PROMISE',
  payload: Promise.resolve(),
})
```

The middleware can also be combined with [Redux Thunk](https://github.com/gaearon/redux-thunk) to chain action creators.

```js
const secondAction = (data) => ({
  type: 'TWO',
  payload: data,
})

const first = () => {
  return (dispatch) => {
    const response = dispatch({
      type: 'ONE',
      payload: Promise.resolve(),
    })

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

## Docs and Help

- [Introduction](/docs/introduction.md)
- [Guides](/docs/guides/)
- [Examples](/examples)

## Issues and Pull Requests

- [Contributing Guide](/.github/CONTRIBUTING.md)
- [Code of Conduct](/.github/CODE_OF_CONDUCT.md)

## Releases

- [Releases](https://github.com/pburtchaell/redux-promise-middleware/releases)
- [Version Upgrade Guide](/docs/upgrading.md)

**Older versions:**

- [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

- Patrick Burtchaell (pburtchaell):
  - [Twitter](https://twitter.com/pburtchaell)
  - [GitHub](https://github.com/pburtchaell)
- [Thomas Hudspith-Tatham (tomatau):
  - [GitHub](https://github.com/tomatau)

Please reach out to us if you have any questions!

---
Copyright (c) 2015-Current Patrick Burtchaell. [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-global-action · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
