0.0.3 • Published 5 years ago

redux-house v0.0.3

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

redux-house

Build Status codecov npm

Table of Contents

Installation

yarn add redux-house
# or
npm install --save redux-house

Documentation

createAction

// actions.js
import { createAction } from 'redux-house';

const setEmpty = createAction('SET_EMPTY');

const setUser = createAction('SET_USER', 'user');

const setToken = createAction('SET_TOKEN', 'token', value => `Bearer ${value}`);

empty(); // { type: 'SET_EMPTY' }
setUser('Doug'); // { type: 'SET_USER', user: 'Doug' }
setToken('abc123'); // { type: 'SET_TOKEN', token: 'Bearer abc123' }

createActions

// actions.js
import { createActions } from 'redux-house';

const actions = createActions({
  SET_EMPTY: null,
  SET_USER: 'user', // or ['user']
  SET_TOKEN: ['token', value => `Bearer ${value}`],
});

actions.setEmpty(); // { type: 'SET_EMPTY' }
actions.setUser('Doug'); // { type: 'SET_USER', user: 'Doug' }
actions.setToken('abc123'); // { type: 'SET_TOKEN', token: 'Bearer abc123' }
0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago