Notes

reconcileChildFibers

一句话结论:reconcileChildFibers 是协调(reconcile)的总入口,它根据 newChild 的形态(单元素/数组/迭代器/文本)分派到不同算法,并在更新场景下标记 Placement/Deletion 等副作用。

1. 它处理哪些形态

  • 单个 ReactElement:走 reconcileSingleElement
  • 文本节点:走 reconcileSingleTextNode
  • 数组 children:走 reconcileChildrenArray
  • 迭代器:走 reconcileChildrenIterator(与数组类似)

2. mount 与 update 的差异

  • mount:通常不需要追踪 side effects(没有旧节点可对比)
  • update:需要 shouldTrackSideEffects,把插入/删除/移动标记成 flags

3. 结果是什么

  • 返回新的第一个子 Fiber
  • 通过 child/sibling 串起整层 children 的 Fiber 链

关联阅读

cd ..