redux-ducky
A special kind of redux duck.
Installation
$ npm install --save redux-ducky
Usage
Initialize a ducky by defining its default state.
import Ducky from 'redux-ducky';
const DEFAULT_STATE = {};
const ducky = new Ducky(DEFAULT_STATE);
Then define some actions for your ducky. The first argument it the action name, and the remaining arguments are the properties to update in the store.
ducky.define('SOME_ACTION', 'prop1', 'prop2', 'prop3');
The ducky can then generate a reducer, actions, and action types. CONSTANT_CASE
will be inforced for action types and camelCase
will be enforced for action names.
const {actions, reducer} = ducky;
export default ducky;
// or
export { actions, reducer };
Actions
Action are automatically generated to update the specified properties listed in their definitions.
import {actions} from '../duckies/someDucky';
actions.someAction(prop1, prop2, prop3);
Reducer
Reducers Use as you would any normal reducer.
License
MIT © Jordan Richlen