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.
npm install @github1/redux-modules --save
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();