0.2.1 • Published 4 years ago

redux-pro-kit v0.2.1

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

Version License

redux-pro-kit

Redux helper functions based on redux-starter-kit.

Getting Started

npm install redux-pro-kit

What's Included

  • A createAction utility that returns an action creator function for the given action type string. The function itself has toString() defined, so that it can be used in place of the type constant.

  • A createReducer utility that lets you supply a lookup table of action types to case reducer functions, rather than writing switch statements. In addition, it automatically uses the immer library to let you write simpler immutable updates with normal mutative code, like state.todos3.completed = true.

Examples:

import { createAction } from 'redux-pro-kit'

export const increment = createAction('counter/increment')

let action = increment()
// { type: 'counter/increment' }

action = increment(3)
// returns { type: 'counter/increment', payload: 3 }

console.log(`The action type is: ${increment}`)
// { type: 'counter/increment', payload: 3 }
import { createReducer } from 'redux-pro-kit'
import { increment, decrement } from 'actions/counter'

const counterReducer = createReducer(0, {
  [increment]: (state, { payload }) => state + payload,
  [decrement]: (state, { payload }) => state - payload
})

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the MIT License - see the LICENSE file for details

0.2.1

4 years ago

0.2.0

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.1

5 years ago

1.0.0

5 years ago