join-reducers

Joins Multiple Redux Reducers

Showing:

Popularity

Downloads/wk

13

GitHub Stars

0

Maintenance

Last Commit

5yrs ago

Contributors

1

Package

Dependencies

1

Size (min+gzip)

0.8KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

joinReducers

joinReducers(f1, f2, .., fk) returns new reducer that returns same result of fk(... f2(f1(state, action), action) ..., action).

Usage

var joinReducer = require('join-reducers');

// assumes two reducers
function reduceA(state, action) {
  switch (action.type) {
    case 'ACTION_A':
      return state + 'a';
    default:
      return '';
  }
}

function reduceB(state, action) {
  switch (action.type) {
    case 'ACTION_B':
      return state + 'b';
    default:
      return '';
  }
}

// joins two reducers
var reducer = joinReducers(reduceA, reduceB);

console.log(reducer('', { type: 'A'})); // 'a';
console.log(reducer(reducer('', { type: 'A'})), { type: 'B' }); // 'ab';

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100