1.1.3 • Published 7 years ago

reducer-generator-object-map v1.1.3

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

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) */ )

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

These amazing people are maintaining this project:

No sponsors yet! Will you be the first?

These amazing people have contributed code to this project:

Unless stated otherwise all works are:

and licensed under: