File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
src/react/v17.0.2/react-reconciler/src Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -166,12 +166,15 @@ if (__DEV__) {
166166// 初始化更新对象
167167export function initializeUpdateQueue < State > ( fiber : Fiber ) : void {
168168
169+ // 对于HostRoot或者ClassComponent会使用initializeUpdateQueue创建updateQueue,然后将updateQueue挂载到fiber节点上
169170 // 创建一个更新,并将其挂载到 fiber 节点的 updateQueue 身上
170171 const queue : UpdateQueue < State > = {
171- // 初始值
172+ // 初始值 //初始state,后面会基于这个state,根据Update计算新的state
172173 baseState : fiber . memoizedState ,
173- firstBaseUpdate : null ,
174- lastBaseUpdate : null ,
174+ firstBaseUpdate : null , // Update形成的链表的头
175+ lastBaseUpdate : null , // Update形成的链表的尾
176+ //新产生的update会以单向环状链表保存在shared.pending上,计算state的时候会剪开这个环状链表,
177+ // 并且连接在 //lastBaseUpdate后
175178 shared : {
176179 pending : null ,
177180 interleaved : null ,
You can’t perform that action at this time.
0 commit comments