create-reducer-extra
Provides some extras for creating boilerplate-free reducers
Usage
As a convenience* all reducing functions are called directly with the actions payload property
const actionHandler = { ... } { ... }
createMergeReducer
Allows you to only specify what has changed in your reducing function, e.g
const initialState = animals: 'ant' 'bat' counter: 2 const reducer = // { counter: 7, favoriteFoods: ['chocolate', 'pizza'] } // { counter: 2, favoriteFoods: ['ant', 'bat', 'cat', 'dog] }
createReducer
For when you want to specify exactly what the next state will be
const initialState = animals: 'ant' 'bat' counter: 2 const reducer = // { counter: 5 }// Note the missing 'animals' property
createResetReducer
Provides the ability to reset a reducer to its initial state
const initialState = animals: 'ant' 'bat' counter: 2 const reducer = const nextState = // { counter: 7, favoriteFoods: ['chocolate', 'pizza'] } // { animals: ['ant', 'bat'], counter: 2 } === initialState