@markorusic/create-reducer
TypeScript icon, indicating that this package has built-in type declarations

1.3.0 • Public • Published

@markorusic/create-reducer

npm (scoped) npm bundle size (minified)

Create cleaner, more readable, boilerplate-free reducers applicable to any JavaScript environment.

Install

$ npm i @markorusic/create-reducer

Usage

import createReducer from '@markorusic/create-reducer'

const initialState = { count: 0 }

const actionTypes = {
  increment: 'increment',
  decrement: 'decrement'
}

const counterReducer = createReducer({
  [actionTypes.increment]: state => ({
    count: state.count + 1
  }),
  [actionTypes.decrement]: state => ({
    count: state.count - 1
  })
}, initialState)

Readme

Keywords

none

Package Sidebar

Install

npm i @markorusic/create-reducer

Weekly Downloads

0

Version

1.3.0

License

MIT

Unpacked Size

2.6 kB

Total Files

4

Last publish

Collaborators

  • markorusic