ReactDOM.render()
- 第一次渲染,入口
render
params
- element: 经过 babel 编译后 React.createElement 对象
- container: dom 对象,div#root
- callback: 渲染完成后到回调函数(不需要关注,一般没用)
legacyRenderSubtreeIntoContainer
params
- parentComponent: null
- children: React.createElement
- container: div#root
- forceHydrate: false; 客户端渲染 和 服务端渲染 区分标识
- callback
功能
- 创建 FiberRoot 和 RootFiber
updateContainer
params
- element: React.createElement
- container: FiberRoot
- parentComponent
- callback
功能
- 通过 rootFiber 得到 lane
- 创建 update 对象,放到 updateQueue 中
scheduleUpdateOnFiber
params
- fiber
- lane
- eventTime
功能
- 获取 fiber 的 root: markUpdateLaneFromFiberToRoot
performSyncWorkOnRoot
params
- root: FiberRoot
功能
- 执行 renderRoot 和 commitRoot
- root.finishedWork = root.current.alternate(workInProgress)
- root.finishedLanes = lanes;
renderRoot
params
- root
- lanes
功能
- 创建 workInProgress: prepareFreshStack
- root.finishedWork 、 finishedLanes 恢复默认值
- workInProgressRoot = root;
- 给全局 workInProgress 赋值
- 执行 workLoop
workLoop
功能
- 执行 while 循环: 判断条件—— workInProgress !== null;(只有 rootFiber.return 是 null)
performUnitOfWork
params
- unitOfWork: workInProgress
功能
- 执行 beginWork
- 执行 completeUnitOfWork
commitRoot
params
- root
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。