Find file Copy path
8a55b63 Oct 8, 2017
2 contributors

Users who have contributed to this file

@pburtchaell @kishorevarma
17 lines (12 sloc) 467 Bytes

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

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