redux-reducers-hub

0.1.1 • Public • Published

redux-reducers-hub

Build Status Coverage Status npm version

Flexible Redux Reducers

Installation

npm i --save redux-reducers-hub

Usage

Add reducers

import reducer from 'redux-reducers-hub';

reducer.add({
  ADD(state, action) {
    return {text: action.text};
  },
  EDIT(state, action) {
    return {text: action.text, edit: true}
  },
}, 'todo');
// state look like {todo: {...}}

Use with store

var {createStore} = require('redux');
var reducer = require('redux-reducers-hub');

// create store with registered reducer
const store = createStore(reducer);

API

  1. add(reducers, scope = "general", defaultState = {}) add new reducers to hub
  2. remove(scope = "general", ?type) Remove old reducer from hub
  3. replace(reducers, scope = "general", defaultState = {}) Replace reducers for a scope
  4. reset() Reset all reducer data

Package Sidebar

Install

npm i redux-reducers-hub

Weekly Downloads

1

Version

0.1.1

License

MIT

Last publish

Collaborators

  • apentle