chrome redux的调试

作者: 吴佳浩 | 来源:发表于2018-09-12 11:48 被阅读0次

    那现在我们来一起看看如何使用吧

    //1、createStore是用来创建store的
    //2、applyMiddleware 是用来处理中间件的
    //3、compose是用来组合createStore当中的多个函数
    import {createStore,applyMiddleware,compose} from 'redux'
    //处理redux的异步任务的中间件
    import thunk from 'redux-thunk'
    //导入的reducer (就是执行规则)
    import { counter } from './index.redux' 
    
    const store = createStore(counter,compose(
    //处理redux的异步任务的中间件thunk使用applyMiddleware来管理thuk
      applyMiddleware(thunk),
    //判断是否有插件 ,有就执行一下,,没有就是一个空函数
    window.devToolsExtension?window.devToolsExtension() : f => f
    ))
    
    
    
    • 现在就可以愉快的调试redux了


    相关文章

      网友评论

        本文标题:chrome redux的调试

        本文链接:https://www.haomeiwen.com/subject/qtkvgftx.html