1.0.1 • Published 5 years ago

redux-simple-action-helpers v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

npm version Build Status Coverage Status Inline docs Hit Count Build Dependencies Dev Dependencies

NPM

contributions welcome

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