An undo redo package for redux
npm install @intactile/redux-utils
or
yarn add @intactile/redux-utils
Create a reducer which delegates to case reducers:
import { createModuleReducer } from "@intactile/redux-utils";
const caseReducers = {
ADD: (state, action) => state + action.payload,
MULTIPLY: (state, action) => state * action.payload,
DIVIDE: (state, action) => state / action.payload
};
const initialState = 10;
const reducer = createModuleReducer(caseReducers, initialState);
import { createActionCreator } from "@intactile/redux-utils";
const add = createActionCreator('ADD');
add(10): // => { type: ADD, payload: 10 }