wrapping dispatch() to log actions
logger 中间件
函数addLoggingToDispatch
,接受一个store为参数,返回一个新的dispatch方法,将store.dispatch覆盖,并log出相对应的action和state信息。
the addLoggingToDispatch function takes the dispatch from the store and returns a new version of dispatch that logs every action and the state
1 | const addLoggingToDispatch = (store) => { |
wrapping dispatch() to recognize promise
promise中间件
redux 只能dispatch普通的对象,不能dispatch promise
函数addLoggingToDispatch
,接受一个store为参数,返回一个新的能处理promise的dispatch方法,。
a function addPromiseSupport() that takes the store and returns a version of dispatch that supports promises.