redux-types-creator
v0.0.10
Published
types generator for redux
Downloads
46
Maintainers
Readme
redux-types-creator
types generator for redux 😎
Installation
$ npm install redux-types-creator --save
or
$ yarn add redux-types-creator
Examples which uses redux-types-creator:
Usage (use ES6 Modules)
// const reduxTypesCreator = require("redux-types-creator").default; // use require
import reduxTypesCreator from "redux-types-creator";
const actionTypes = reduxTypesCreator(true) // true - object will be frozen.
('START', 'FINISH', 'ERROR') // postfix
('CREATE_ITEMS', 'GET_ITEMS', 'DELETE_ITEMS'); // types
console.log(actionTypes);
/*
{
CREATE_ITEMS: {
START: 'CREATE_ITEMS_START',
FINISH: 'CREATE_ITEMS_FINISH',
ERROR: 'CREATE_ITEMS_ERROR',
SELF: 'CREATE_ITEMS'
},
GET_ITEMS: {
START: 'GET_ITEMS_START',
FINISH: 'GET_ITEMS_FINISH',
ERROR: 'GET_ITEMS_ERROR',
SELF: 'GET_ITEMS'
},
DELETE_ITEMS: {
START: 'DELETE_ITEMS_START',
FINISH: 'DELETE_ITEMS_FINISH',
ERROR: 'DELETE_ITEMS_ERROR',
SELF: 'DELETE_ITEMS'
}
}
*/
const { CREATE_ITEMS, GET_ITEMS, DELETE_ITEMS } = actionTypes;
CREATE_ITEMS.SELF // CREATE_ITEMS
CREATE_ITEMS.START // CREATE_ITEMS_START
CREATE_ITEMS.FINISH // CREATE_ITEMS_FINISH
CREATE_ITEMS.ERROR // CREATE_ITEMS_ERROR
// action creator
getItems = () => ({
type: CREATE_ITEMS.SELF
})