A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pburtchaell/redux-promise-middleware/tree/5.1.1 below:

GitHub - pburtchaell/redux-promise-middleware at 5.1.1

Redux Promise Middleware

Redux promise middleware enables robust handling of async action creators in Redux: it accepts a promise and dispatches pending, fulfilled and rejected actions.

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

The middleware can also be combined with Redux Thunk to chain action creators.

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))
    })
  }
}
Documentation and Help Issues and Pull Requests Releases

Older versions:

Maintainers

Please reach out to us if you have any questions!

Copyright (c) 2015-Current Patrick Burtchaell. Code licensed with the MIT License (MIT). Documentation licensed with the CC BY-NC License.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4