redux-simple-action-helpers
v1.0.1
Published
redux helpers for simple action and action creators
Downloads
6
Maintainers
Readme
Installation
install
$ npm i redux-simple-action-helpers
$ yarn add redux-simple-action-helpers
Motivation
action creators usually follow the same rules. Get input, create flux standard action based on input
Example
action creator
import { createActionCreator } from 'redux-simple-action-helpers';
export const toggleRowItem = createActionCreator('TOGGLE_ROW_ITEM', (row, idx) => { payload : { row, idx} });
which is equal to
export const toggleRowItem = createActionCreator('TOGGLE_ROW_ITEM', ['row', 'idx']);
or
export const toggleRowItem = createActionCreator('TOGGLE_ROW_ITEM', ({row, idx}) => { payload : { row, idx} });
which is equal to
export const toggleRowItem = createActionCreator('TOGGLE_ROW_ITEM');
API
createActionCreator(type, fn);
fn = (...args) => { payload, error, meta };
or
fn = Array
License
MIT