reux
wodata1
这个作者很懒,什么都没留下…
展开
-
redux 源码解读-createStore
首先,个人比较少些文章,可能文笔不太好,请勿喷,第二,本文仅限于个人理解,如果异议,欢迎一同探讨QQ:251801008 接下来还会写其他相关的文章 首先我们可以看到redux源码目录下的源码主要只有6个文件 在utils包下面的是一个工具类,用来抛出错误警告 我们主要关注的是applyMiddleware,bindActinCreators,combineReducers,compo...原创 2018-09-06 15:20:36 · 295 阅读 · 0 评论 -
redux 源码解读-applyMiddleware
hello,大家好,之前我们大概分析了一下createStore中的代码,但应该还是有很多迷迷糊糊的,感觉不知所以。毕竟这个redux中有很多的牵扯,所以当你把整个redux源码都看了一遍,就会大概的了解redux的原理 下面我们来分析一下applyMiddleware export default function applyMiddleware(...middlewares) { // 传...原创 2018-09-07 11:35:36 · 370 阅读 · 0 评论 -
redux 源码解读-bindActionCreators
redux的核心就在于createStore 和 applyMiddleware这两个类里面 bindActionCreator这个只是一个辅助类 下面我们看看源码 function bindActionCreator(actionCreator, dispatch) { return (...args) => dispatch(actionCreator(...args)) // 返...原创 2018-09-07 12:16:18 · 251 阅读 · 0 评论 -
redux 源码解读-
这里直接贴代码: export default function combineReducers(reducers) { // reducers : {} const reducerKeys = Object.keys(reducers) // 获得传进来对象的key const finalReducers = {} // 声明finalReducers 这用来存储最终的reducers...原创 2018-09-25 15:50:33 · 121 阅读 · 0 评论