@ackee/redux-utils
TypeScript icon, indicating that this package has built-in type declarations

4.1.4 • Public • Published

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


Installing

# Using yarn:
$ yarn add @ackee/redux-utils

# Using npm:
$ npm i -S @ackee/redux-utils

Don't forget to install peerDependencies too

Configuration (optional)

Available options:

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

// Defaults:
configure({
    // 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';

configure({
    // ...

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

Readme

Keywords

none

Package Sidebar

Install

npm i @ackee/redux-utils

Weekly Downloads

43

Version

4.1.4

License

MIT

Unpacked Size

372 kB

Total Files

156

Last publish

Collaborators

  • pivl
  • hofp37
  • grissius
  • ackeecz
  • horaklukas
  • borecekbaji
  • davidbilik