Skip to content

A reducer-generator which builds a redux-reducer that reduces an array of reducers.

License

Notifications You must be signed in to change notification settings

Dash-OS/reducer-generator-array-map

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

reducer-generator-array-map

A reducer-generator which builds a reducer that reduces an array of reducers.

Installation

yarn add reducer-generator-array-map

or

npm install --save reducer-generator-array-map

Simple Example

import createArrayMapReducer from 'reducer-generator-array-map'

const system = createArrayMapReducer({ /* initial state */ }, [
  (state, action) => action.type === 'SYSTEM_ONLINE'
    ? { ...state, isOnline: true }
    : state,
  (state, action) => action.type === 'SYSTEM_OFFLINE'
    ? { ...state, isOnline: false
    : state
], /* You may pass extra args that will be passed to the reducer(s) */)

About

A reducer-generator which builds a redux-reducer that reduces an array of reducers.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published