💫
Promise Middleware
  • Introduction
  • Getting Started
    • Introduction
    • Design Principles
  • Guides
    • Catching Errors Thrown by Rejected Promises
    • Chaining Actions
    • Comparison to other promise middleware
    • Custom Type Delimiters
    • Custom Types
    • Optimistic Updates
    • Use with Async/Await
    • Use with Reducers
    • Use with Redux Actions
    • Use with Redux Promise Actions
    • Use with Promises Resolved with Null Values
  • Upgrade Guides
    • Upgrade from 5.x to 6.0.0
    • Upgrade from 4.x to 5.0.0
    • Upgrade from 3.x to 4.0.0
    • Release History
Powered by GitBook
On this page
  1. Guides

Use with Redux Actions

To use this middleware with Redux Actions, return a promise from the payload creator. Note this example is experimental and not tested; it may not work as expected.

// Create an async action
const fooAction = createAction('FOO', async () => {
  const { response } = await asyncFoo();
  return response;
});

// Use async action
fooAction('123')

This would dispatch FOO_PENDING and FOO_FULFILLED with the data as the payload.

PreviousUse with ReducersNextUse with Redux Promise Actions

Last updated 7 years ago