2.0.0 • Published 8 years ago

redux-createreducer v2.0.0

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

create-reducer

Creates a Redux reducer from an ActionHandlers object

build status npm version npm downloads

CreateReducer :: State a, ActionHandlers b, Action c => a,b -> (a,c -> a)

ActionHandlers :: ActionType a, State b, Action c => {a: (b,c -> b), ...}

Creates a reducer from an object that each property name is an actionType and its value is a function that receive a state and an action and return a new state

How to install

$ npm install redux-createreducer --save

Example:

import createReducer from 'redux-createreducer';

const initialState = 0;
const actionHandlers = {
	'INCREMENT': (state, action) => state + 1,
	'DECREMENT': (state, action) => state - 1
};

const reducer = createReducer(initialState, actionHandlers);
2.0.0

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago