Compose a reducer from a map of action handlers


stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
20Apr 23, 2016Dec 6, 2015Minified + gzip package size for @f/handle-actions in KB



Build status Git tag NPM version Code style

Compose a reducer from a map of action handlers. Very similar to handleActions in https://github.com/acdlite/redux-actions, but broken out as its own separate micro-module, and it also passes your handlers only action.payload. Note, this obviously assumes that you are using the flux standard action style, of type for the identifier and payload for the contents of your message. This means your reducers will be unable to examine any other fields (e.g. meta) - if you want to use other fields, don't use this module.


$ npm install @f/handle-actions


var handleActions = require('@f/handle-actions')

  UPDATE_ITEM: (state, changes) {
    // action.type === 'UPDATE_ITEM'
    return {


handleActions(map, defaultState)

  • map - Map of action types to handlers.
  • defaultState - Optional default state. This is returned if state is undefined.

Returns: A composite reducer of the reducers in your map, scoped to their specified actions.



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.