jillesme / create-reducers

A tiny utility to create reducer maps for Redux.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

create-reducer-map

A tiny utility to create reducer maps for Redux.

import createReducer from 'create-reducer-map';

const initialState = {};

export default createReducer(initialState, {
  SOME_ACTION: (state, payload) => state,
  ANOTHER_ACTION: {
    next: (state, payload) => state,
    throw: (state, payload) => state, // Get's hit when `{ error: true }` is specified in the action
  },
});

About

A tiny utility to create reducer maps for Redux.

License:ISC License


Languages

Language:JavaScript 100.0%