redux-actions-generator

1.0.0 • Public • Published

redux-actions-generator

Flux Standard Action type generator for Redux.

NPM

Installation

The npm package provides a CommonJS build for use in Node.js, and with bundlers like Webpack and Browserify. It also includes an ES modules build that works well with Rollup and Webpack2's tree-shaking.

npm install --save redux-actions-generator

or

yarn add redux-actions-generator

Usage

createAction(prefix<string>, actions <Array<string>>)

import createActions from 'redux-actions-generator';
 
const actions = createActions(
    'TODO', 
    [
        'ADD_TODO',
        'TOGGLE_TODO',
        'SET_VISIBILITY_FILTER',
    ]
)
 
expect(actions).to.deep.equal({
    ADD_TODO: 'TODO/ADD_TODO',
    TOGGLE_TODO: 'TODO/TOGGLE_TODO',
    SET_VISIBILITY_FILTER: 'TODO/SET_VISIBILITY_FILTER',
});
 

Real world example

actions.js

import createActions from 'redux-actions-generator';
 
const actions = createActions('', [
    'ADD_TODO',
    'TOGGLE_TODO',
    'SET_VISIBILITY_FILTER',
])
 
export default actions;

Package Sidebar

Install

npm i redux-actions-generator

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

8.57 kB

Total Files

5

Last publish

Collaborators

  • puemos