reducer-generator-object-map

1.1.3 • Public • Published

reducer-generator-object-map

NPM version NPM downloads Dependency Status Travis CI Build Status Coveralls Coverage Status PayPal donate button

A redux reducer-generator that builds a redux-reducer which matches against object literals.

You may pass extra arguments when creating the reducer and when reducing. The resulting arguments will be (...initialArgs, ...reducerArgs).

Installation

yarn add reducer-generator-object-map

or

npm install --save reducer-generator-object-map

Simple Example

import createObjectMapReducer from 'reducer-generator-object-map'
 
const system = createObjectMapReducer({ /* initial state */ }, {
  'SYSTEM_ONLINE': (state, { type, ...action }, ...extraArgs) => ({
    ...state,
    isOnline: true
  }),
  'SYSTEM_OFFLINE': (state, { type, ...action }, ...extraArgs) => ({
    ...state,
    isOnline: false
  })
}, /* You may pass extra args that will be passed to the reducer(s) */ )

History

Discover the release history by heading on over to the releases page.

Backers

Maintainers

These amazing people are maintaining this project:

Sponsors

No sponsors yet! Will you be the first?

PayPal donate button

Contributors

These amazing people have contributed code to this project:

License

Unless stated otherwise all works are:

  • Copyright © Braden R. Napier

and licensed under:

Package Sidebar

Install

npm i reducer-generator-object-map

Weekly Downloads

2

Version

1.1.3

License

MIT

Last publish

Collaborators

  • bradynapier