Install
npm install ts-reducer-creator
How to use
First you need to define your actions and their payload types
and State
Then you can call createHelpers
; ;
to create
- reducer - your reducer function
- actionCreators - action creators
actionCreators.setValue(10)
- ofTypeFilters - action filters for
Obserable<Action>
. It can be used withredux-observable
orngrx effects
actions$.pipe(ofTypeFilters.increment)
- actionTypes - action types
actionTypes.increment
Boilerplate vs ts-reducer-creator
Boilerplate
;
ts-reducer-creator
;
Examples
https://github.com/ptol/ts-reducer-creator/tree/master/examples
Angular with ngrx
https://github.com/ptol/ts-reducer-creator/blob/master/examples/angular/src/app/newStore.ts
React with redux and redux-observable
https://github.com/ptol/ts-reducer-creator/blob/master/examples/react/src/newStore.ts