Skip to content

A dead simple Flux standard action-type generator for Redux.

Notifications You must be signed in to change notification settings

puemos/redux-actions-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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;

About

A dead simple Flux standard action-type generator for Redux.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published