react的redux中间件

redux 的中间件(对dispatch功能的拦截和增强,一般不用自己写,有插件)

dispath是一个方法,可以自行中间拦截更改:

store.dispatch = function(action){
console.log("dispatch执行了")

 next(action);

console.log("执行后的dispatch",store.getState) 

二、CreateStore的参数:

参数1:reducer;

参数2:init state;

参数3:使用的中间件; 

logger插件增强dispatch的功能,在dispatch时打印日志,得到dispatch之前和之后的state;

原文地址:https://www.cnblogs.com/yunshangwuyou/p/9510336.html