0.0.3 • Published 4 years ago

@mkusaka/reproduce v0.0.3

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

@mkusaka/reproduce

install

npm

npm install @mkusaka/reproduce ---save

yarn

yarn add @mkusaka/reproduce

usage

import { reproduce } from "@mkusaka/reproduce"

const reducer = (state: {
  age: number,
  name: string
}, action) => {
  switch (action.type) {
    case "increment":
      // returns new object.
      // reproduce avoid to modify argument directly.
      // just as Immer's produce.
      return reproduce(state, (state) => {
        state.age++
      })
    default:
      return state
  }
}
0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago