# Introduction

[![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 simple, yet robust handling of async action creators in [Redux](http://redux.js.org).

```javascript
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.

```javascript
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](https://pburtchaell.gitbook.io/redux-promise-middleware/getting-started/introduction)
* [Guides](https://github.com/pburtchaell/redux-promise-middleware/tree/bb9c9fa76466d1019f7066bb5892bc8623b0fb96/docs/guides/README.md)
* [Examples](https://github.com/pburtchaell/redux-promise-middleware/tree/bb9c9fa76466d1019f7066bb5892bc8623b0fb96/examples/README.md)

**Heads Up:** Version 6 includes some breaking changes. Check the [upgrading guide](https://pburtchaell.gitbook.io/redux-promise-middleware/upgrade-guides/v6) 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](https://pburtchaell.gitbook.io/redux-promise-middleware/upgrade-guides/v6)
* [Upgrade from 4.x to 5.0.0](https://pburtchaell.gitbook.io/redux-promise-middleware/upgrade-guides/v5)
* [Upgrade from 3.x to 4.0.0](https://pburtchaell.gitbook.io/redux-promise-middleware/upgrade-guides/v4)

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):

* [Twitter](https://twitter.com/pburtchaell)
* [GitHub](https://github.com/pburtchaell)

Thomas Hudspith-Tatham (tomatau):

* [GitHub](https://github.com/tomatau)

## License

[Code licensed with the MIT License (MIT)](https://github.com/pburtchaell/redux-promise-middleware/tree/bb9c9fa76466d1019f7066bb5892bc8623b0fb96/LICENSE/README.md).

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pburtchaell.gitbook.io/redux-promise-middleware/master.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
