redux-actions-promise-wrapper
Type safe redux action creator (works with redux saga)
Installation
npm install redux-actions-promise-wrapper --saveyarn add redux-actions-promise-wrapperbower install redux-actions-promise-wrapper --save
Feature
Create type safe action creators and enable callback for redux saga.
Example Project
https://github.com/thu-san/redux-actions-promise-wrapper-usage-example
Usage
TypeScript
Create Action
; , >;
login
now contains the following properties
login.TRIGGER = 'LOGIN/TRIGGER';login.SUCCESS = 'LOGIN/SUCCESS';login.FAILURE = 'LOGIN/FAILURE'; login.triggerpayload ===; // payload must have type { email: string, password: string }login.successpayload ===; // payload must have type { session: string }login.failure ===; loginpayload === login.triggerpayload;You can also call on login for trigger action.
Redux Saga Example
Types, Saga and Reducer
// TYPES ;; // SAGA // REDUCER ; ; ; ;
Combine Reducer
;; ; ; ; // saga; ;
Container
; ; ; ;