redux-create-reducer-curry

1.0.0 • Public • Published

redux-create-reucer-curry

Build Status

create fast, save, readability reducer with fp curry

install

npm i -S redux-create-reducer-curry

API

createReducer([initState: any])([actions: obj])

  • initState
    • default: {}
    • reducer init state
  • actions
    • default: {}
    • a plain obj with function for action
      • key is action type, val is action to change reducer
      • function: (state, action) => {}
        • state: the reducer state
        • action: the action
  • @return reducer function
    • reducer for redux

usage

import createReducer
 
// reducer
export default createReducer({isDemo: true})({
  TOGGLE: (state, action) => ({isDemo: !state.isDemo})
})
 
// action
function toggle(){
  return {
    type: 'TOGGLE'
  }
}

Readme

Keywords

Package Sidebar

Install

npm i redux-create-reducer-curry

Weekly Downloads

4

Version

1.0.0

License

ISC

Last publish

Collaborators

  • eyasliu