sdg*_*sdh 2 javascript logging reactjs redux
我想通过在控制台中记录发送给调度程序的每个操作来调试我的Redux应用程序.
什么通常被认为是这样做的最佳方法?
您可以使用简单的日志记录中间件,例如redux中间件文档中的示例:
const logger = store => next => action => {
console.group(action.type)
console.info('dispatching', action)
let result = next(action)
console.log('next state', store.getState())
console.groupEnd(action.type)
return result
}
Run Code Online (Sandbox Code Playgroud)
或者使用redux-logger模块,它基本上做同样的事情.
| 归档时间: |
|
| 查看次数: |
1287 次 |
| 最近记录: |