redux-saga-middleware
Redux middleware for achieving callbacks in redux-saga
When use redux-saga-middleware ?
When you need to access the server validation message , not for display data(which should be in redux store)!
Installation
npm install redux-saga-middleware --save
or
yarn add redux-saga-middleware
Basic Usage
store.js
//config store with redux-saga-middleware;; //you alse can also config generator runtime without babel-polyfill; const sagaMiddleware = ;const middlewares = sagaMiddleware reduxSagaMiddleware { return state;} const store = ; sagaMiddleware;
saga.js
{ ; action;} { } ;
test.js
const asynAction = ; ;
Usage with react-redux
connect.js
; const asynAction = ; const mapState = { return ;}; const mapDispatchToProps = { return ; }; mapState mapDispatchToPropsComponent;
component.js
thisprops