Common Redux utilities - reducer factories, utility for generating action types.

Usage no npm install needed!

<script type="module">
  import ackeeReduxUtils from 'https://cdn.skypack.dev/@ackee/redux-utils';



GitHub license"> CI Status PRs Welcome Dependency Status bundlephobia bundlephobia

Redux Utilities

Common Redux utilities, including:

  • Reducer factories (containerReducer, resetReducer, basicApiReducer a more).
  • Generic API request action type and creator factories (asyncType, apiRequestActions).

Table of contents


Using yarn:

$ yarn add @ackee/redux-utils

Using npm:

$ npm i -S @ackee/redux-utils

Configuration (optional)

Available options:

  • Set initial reducer state globally.
  • Set custom logger.
import { configure } from '@ackee/redux-utils';

// Defaults:
    // Pass any object with error, warn and info methods.
    logger: console,

    containerReducer: reducerConfig => reducerConfig,
    basicApiReducer: reducerConfig => reducerConfig,
    paginationApiReducer: reducerConfig => reducerConfig,
    infiniteListApiReducer: reducerConfig => reducerConfig,

Change reducer initial state globally

import { configure } from '@ackee/redux-utils';

    // ...

    basicApiReducer: ({ initialState, ...rest }) => {
        return {
            initialState: {
                // Override default error initial value:
                error: null,