Miss any of our Open RFC calls?Watch the recordings here! »

create-redux-reducer-from-map

1.0.0 • Public • Published

My own personal preference for building reducers for Redux.

 
var makeReducer = require('create-redux-reducer-from-map')
 
const arithmeticReducer = makeReducer({
    ADD: (state, action) => state + action.payload,
    SUBTRACT: (state, action) => state - action.payload
}, 0)
 
 

makeReducer(mapOfFunctions[, initialState])

Returns a reducer appropriate for Redux. Takes an map of action types to functions taking (state, action).

License

WTFPL

Keywords

Install

npm i create-redux-reducer-from-map

DownloadsWeekly Downloads

1

Version

1.0.0

License

WTFPL

Last publish

Collaborators

  • avatar