react源码
  • schedule阶段 进行调度 scheduler(优先级队列、小顶堆)

  • render阶段 进行协调 reconciler - fiber dfs 深度优先遍历 update 单向链表

  • commit阶段 进行渲染 renderer reactDom reactNative reactArt

  • 优先级 lane 模型

  • 并发模型
    function component 和 class component 的区别

1
2
3
4
5
6
7
view

生命周期函数

hooks

react 底层运行流程
  • 掌握思想

  • 掌握关键流程的细节

  • 掌握整体工作流程、局部细节

  • 掌握术语、基本实现思路

函数式编程
代数效应 解决副作用

react 的三种不同模式

  • legacy 模式
    同步优先级
    拥有性能优化特性 batchedUpdates(批处理)
    触发多次 this.setState 是异步更新的

      但是放在 setTimeout 内的话,batchContext 上下文不存在,那么进行同步更新
    
  • blocking 模式

  • concurrent 模式
    异步优先级
    放在 setTimeout 内不一定会同步执行

Author: liuarui
Link: https://liuarui.github.io/2021/07/05/框架/react/react源码杂记/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.