Dead simple redux helpers
Installation
$ npm install --save dead-simple-redux-helper
Usage
;
Creating standard Flux action creators
const MY_ACTION = 'myAction'; // returns flux action creator:const someAction = ; /* returns standard flux action:{ type: MY_ACTION, payload: 'hello'}*/const action = ;
Creating standard Flux action creators with argument transformer
const MY_COMPLEX_ACTION = 'myComplexAction'; // pass property names, which will be used to create `payload` objectconst complexAction = ; /* returns{ type: MY_COMPLEX_ACTION, payload: { name: 'John', lastName: 'Smith', age: 42 }}*/const action = ; /* returns{ type: MY_COMPLEX_ACTION, payload: { name: 'John', lastName: undefined, age: undefined }}*/const action = ;
Creating reducers
const MY_ACTION = 'myAction';const MY_COMPLEX_ACTION = 'myComplexAction'; const initialState = name: '' lastName: '' age: 0 // returns state if action.type does not matchconst myReducer =
License
MIT