摘要:
类组件生命周期 当发现fiber tag = 1时,表示遇到类组件。 /* workloop React 处理类组件的主要功能方法 */ function updateClassComponent(){ let shouldUpdate const instance = workInProgress 阅读全文
posted @ 2021-11-29 08:13
webLion200
阅读(66)
评论(0)
推荐(0)
摘要:
React 有两个重要阶段,render 阶段和 commit 阶段,React 在调和( render )阶段会深度遍历React fiber树,目的就是发现不同(diff),不同的地方就是接下来需要更新的地方,对于变化的组件,就会执行render函数。在一次调和过程完毕之后,就到了commit 阅读全文
posted @ 2021-11-29 08:12
webLion200
阅读(204)
评论(0)
推荐(0)
摘要:
Class组件 在 class 组件中,除了继承 React.Component ,底层还加入了 updater 对象,组件中调用的 setState 和 forceUpdate 本质上是调用了 updater 对象上的 enqueueSetState 和 enqueueForceUpdate 方法 阅读全文
posted @ 2021-11-29 08:11
webLion200
阅读(249)
评论(0)
推荐(0)
摘要:
createElement React.createElement( type, [props], [...children] ) 第一个参数:如果是组件类型,会传入组件对应的类或函数;如果是 dom 元素类型,传入 div 或者 span 之类的字符串。 第二个参数:一个对象,在 dom 类型中为 阅读全文
posted @ 2021-11-29 08:10
webLion200
阅读(59)
评论(0)
推荐(0)

浙公网安备 33010602011771号