reducker
Utility functions for channeling your inner duck and reducing redux boilerplate.
Install
npm i --save reducker
Usage
If you use duck-typing in redux, you'll quickly start to notice that many action creators are just the same trivial boilerplate repeated over and over again. We can reduce this boilerplate by encapsulating the common code.
import { actions } from 'reducker';
const ADD_TODO = 'APP/TODO/ADD'
const addTodo = payload => ({ type: ADD_TODO, payload })
now becomes:
import { actions } from 'reducker';
const ADD_TODO = 'APP/TODO/ADD'
const addTodo = action.payload(ADD_TODO);