/redux-create-reducer

Publishing createReducer from http://redux.js.org/docs/recipes/ReducingBoilerplate.html#generating-reducers

Primary LanguageJavaScript

redux-create-reducer

NPM version Build status Test coverage Downloads

This code packaged as a node module

Usage:

import { createReducer } from 'redux-create-reducer';
import * as ActionTypes from '../constants/ActionTypes';

const initialState = [];


export const todos = createReducer(initialState, {
  [ActionTypes.ADD_TODO](state, action) {
    let text = action.text.trim();
    return [...state, text];
  }
})