@f/combine-reducers

Combines an object of reducers

Stats

StarsIssuesVersionUpdatedCreatedSize
@f/combine-reducers
201.2.16 years ago6 years agoMinified + gzip package size for @f/combine-reducers in KB

Readme

combine-reducers

Build status Git tag NPM version Code style

Combines an object of reducers together to form a single, composite reducer. This function is identical to the one provided by redux but it doesn't do the sanity checks that redux does, which allows you to do a few things like having multiple root reducers combined into one that you can't do with redux's assertions.

Installation

$ npm install @f/combine-reducers

Usage

var combineReducers = require('@f/combine-reducers')

combineReducers({
  counter1: counterReducer,
  counter2: counterReducer
})

function counterReducer (state, action) {
  if (action.type === INCREMENT) {
    return ++state
  }

  return state
}

API

combineReducers(reducers)

  • reducers - An object containing a map of reducers to property names
  • defaultState - Optional. Specify a default value for the state object. Useful for nesting combineReducers calls.

Returns: The combined reducer map as a single reducing function.

License

MIT

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.