File tree Expand file tree Collapse file tree 2 files changed +26
-6
lines changed Expand file tree Collapse file tree 2 files changed +26
-6
lines changed Original file line number Diff line number Diff line change
1
+ 理念:
2
+
3
+ 第一:
4
+
1
5
1 . 使用reconciler(协调器)实现了一个reactDOM
2
6
感觉很多都不太理解吧
3
7
@@ -11,3 +15,19 @@ React 内部实现的一套状态更新机制,支持任务不同的优先级
11
15
其中每个任务更新单元为react element 对应的Fiber节点
12
16
13
17
2.2 Fiber架构的实现原理
18
+ 主要是讲解了下FiberNode的结构
19
+
20
+ 2.3 Fiber架构的工作原理
21
+ - 双缓存,和GPU原理差不多
22
+ 即:curren Fiber Tree 和 workInProgress Fiber Tree
23
+ 并且关于两个棵之前替换,非常精彩
24
+
25
+ 第二:前置知识
26
+ - 源码的文件结构
27
+ - 调试源码
28
+ - 深入理解JSX
29
+
30
+ 架构篇
31
+
32
+
33
+
Original file line number Diff line number Diff line change @@ -5,11 +5,11 @@ function FiberNode(
5
5
mode : TypeOfMode
6
6
) {
7
7
// 做为静态数据结构的属性
8
- this . tag = tag
9
- this . key = key
10
- this . elementType = null
11
- this . type = null
12
- this . stateNode = null
8
+ this . tag = tag // Fiber对应的组件类型 Function、Class、Host
9
+ this . key = key // key 属性
10
+ this . elementType = null // 大部分情况同type,某些情况不同,比如FunctionComponent使用React.memo包裹
11
+ this . type = null // 对于 FunctionComponent,指函数本身,对于ClassComponent,指class,对于HostComponent,指DOM节点tagName
12
+ this . stateNode = null // Fiber对应真实的DOM节点
13
13
14
14
// 用于连接其他Fiber节点形成Fiber树
15
15
this . return = null
@@ -19,7 +19,7 @@ function FiberNode(
19
19
20
20
this . ref = null
21
21
22
- // 做为动态的工作单元的属性
22
+ // 做为动态的工作单元的属性,保存本次更新造成的状态改变相关信息
23
23
this . pendingProps = pendingProps
24
24
this . memoizedProps = null
25
25
this . updateQueue = null
You can’t perform that action at this time.
0 commit comments