💫
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

Custom Type Delimiters

PreviousComparison to other promise middlewareNextCustom Types

Last updated 7 years ago

In the case you need to use different type delimiters, you can configure this globally for all actions. By default, the middleware uses a underscore _ delimiter.

For example, given FOO async action, PENDING type will be appended with a underscore _ delimiter.

{
  type: 'FOO_PENDING'
}

To change the default, supply an optional configuration object to the middleware with the promiseTypeDelimiter property. This property accepts a new string to use as the delimiter.

import { createPromise } from 'redux-promise-middleware';

applyMiddleware(
  createPromise({
    promiseTypeDelimiter: '/'
  })
)

With this configuration, given FOO async action, the type will be appended with a forward slash / delimiter.

{
  type: 'FOO/PENDING'
}

Finally, if you are using a library like , you'll also need to .

type-to-reducer
configure it to handle the custom delimiter]