$ npm install redux-contrib --save
import { createAction, createReducer } from 'redux-contrib';
const createUserAction = createAction('CREATE_USER_ACTION', ['email', 'name']);
const initialState = { user: undefined };
const reducer = createReducer([
[
createUserAction,
(_state, payload, _action) => ({ user: { email: payload.email, name: payload.name } }),
],
], initialState)
const action = createUserAction({ email: '[email protected]', name: 'John Doe' });
reducer(initialState, action);