easy-reducer
Easier reducers with less boilerplate.
Easy reducers generates action creators and types, and makes your reducers reusable.
Installing
npm install --save easy-reducer
Using easy reducers
const defaultState = test: 'data'const syncActions = // previous state is always the last argument. { return ...state test: 'data' + num } { return ...state test: 'data' + num1 + '' + num2 } // async actions are handled differently, and are meant to be used with redux-thunkconst asyncActions = // syncActions, dispatch, getState (from thunk), are always the last arguments. { return { } } const testReducerCreator = // testReducer1 now has all the action creators you would use for your methods, with the types TR1/methodNameconst testReducer1 = // generated types as constants for reference with RXJS epics or whatever// EG: {testDataPlusNum: 'TR1/testDataPlusNum', testDataPlusTwoNum: 'TR1/testDataPlusTwoNum'}console // Reducers are reusable with different ID'sconst testReducer2 = const store = storestore