action-helper
The simplest action creator for redux.
Install
npm install --save action-helper
Why?
To reduce code generation. I was dead tired to write all these actions each time.
const CONSTANT = 'CONSTANT'; // WHY?! constant string itself is a constant const action = type: CONSTANT param;
So I came with action-helper
to reduce all of these with:
; const login = ; // also, you can declare an action using the shorter method// this action creator will be able to receive any property// right into the action, without any restriction like the method aboveconst auth = ;
And now you can get a type of this action by simply doing:
console; // prints LOGIN
And get an action object simply by doing:
console;// logs {type: 'LOGIN', username: 'root', password: 'qwerty'}
When you explicitly declare the properties of an action, you won't get anything except them in the result. But, if you do not declare the properties, action creator function will be able to create an action with any properties that can be passed as an object.
;// {type: 'LOGIN', username: 'root', password: 'qwerty'} ;// {type: 'AUTH', idToken: 'token'}
Less code, less stress.