Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 1.26 KB

File metadata and controls

39 lines (29 loc) · 1.26 KB

@github1/redux-modules

An implementation of the redux modules pattern to modularize redux reducers, middleware and action creators

This package provides utilities for encapsulating redux components such as reducer, middleware, actions, preloadedState in a strongly types structure which makes it simpler to build, organize and reuse logic.

build status npm version npm downloads

Install

npm install @github1/redux-modules --save

Usage

import { createModule } from '@github1/redux-modules';

const store = createModule('myModule')
  .reduce((state: MyState, action: MyActionTypes) => {
    if ('Increment' === action.type) {
      return { ...state, count: state.count + 1 };
    }
    return state;
  })
  .preloadedState({
    count: 0,
  })
  .asStore();

License

MIT