create-a-reducer
v1.0.2
Published
A simple utility function to use with Redux
Downloads
2
Readme
Create Reducer Utility
Install
npm i -S create-a-reducer
Usage
import { createReducer } from 'create-a-reducer';
Example
import { createReducer } from "create-a-reducer";
const initialState = {
isLoading: false,
errors: null
}
const sampleReducer = (state, payload) => ({...state, isLoading: true, errors: null})
export default createReducer(initialState, {
["SAMPLE_ACTION_TYPE"]: sampleReducer
})