多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
## redux-logger ``` import redxLogger from 'redux-logger'; export default createStore(reducer,applyMiddleware(reduxLogger)); ``` 每次状态改变时,会打印改变前以及改变后的状态以及对应的action ![](https://box.kancloud.cn/01830a291acdcdb642da85eebbf8a127_465x208.png) ## redux-thunk ``` npm i redux-thunk ``` ![](https://box.kancloud.cn/2644cc9dd28dfe6af779565e4d4c7cdd_557x855.png) ## redux-promise reject的话 会被忽略 ``` //1) ,promiseIncrement(){ return new Promise(function(resolve,reject){ setTimeout(function(){ resolve({type:types.INCREMENT,payload:1}); //reject无法处理 },1000) }); } ``` 想要不被忽略,直接返回`{}`action对象 ``` //2) ,payloadIncrement(){ return { type:types.INCREMENT ,payload:new Promise(function(resolve,reject){ setTimeout(function(){ if(Math.random()>.5){ resolve(100); }else{ reject(-100); } },1000) }) } } ```