|
|
@ -3,25 +3,15 @@ |
|
|
|
[代码位置](https://github.com/facebook/react/blob/bd4784c8f8c6b17cf45c712db8ed8ed19a622b26/packages/react-reconciler/src/ReactFiberBeginWork.old.js#L3818) |
|
|
|
[代码位置](https://github.com/facebook/react/blob/bd4784c8f8c6b17cf45c712db8ed8ed19a622b26/packages/react-reconciler/src/ReactFiberBeginWork.old.js#L3818) |
|
|
|
|
|
|
|
|
|
|
|
```javascript |
|
|
|
```javascript |
|
|
|
if (workInProgress._debugNeedsRemount && current !== null) { |
|
|
|
function beginWork(current, workInProgress, renderLanes) { |
|
|
|
return remountFiber( |
|
|
|
if (current !== null) { |
|
|
|
current, |
|
|
|
|
|
|
|
workInProgress, |
|
|
|
} else { |
|
|
|
createFiberFromTypeAndProps( |
|
|
|
} |
|
|
|
workInProgress.type, |
|
|
|
|
|
|
|
workInProgress.key, |
|
|
|
|
|
|
|
workInProgress.pendingProps, |
|
|
|
|
|
|
|
workInProgress._debugOwner || null, workInProgress.mode, |
|
|
|
|
|
|
|
workInProgress.lanes |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
这一段逻辑暂时还不清楚,先跳过。 |
|
|
|
beginWork 函数接受三个参数,分别是 current 节点,workInProgress 节点和 renderLanes 优先级,在进入主要函数逻辑 switch 之前,会先对 current 节点进行空值判断, |
|
|
|
|
|
|
|
|
|
|
|
在进入主要函数逻辑之前,会先进入一个对 current 的空值判断,这个 current 就是 React 双缓存机制中的 current Fiber 树的 Fiber 节点,然后进入 |
|
|
|
|
|
|
|
对于首屏渲染而言这里传入的节点会是 FiberNode,也就是除了 FiberRootNode 外的第一个 Fiber 节点 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### beginWork |
|
|
|
### beginWork |
|
|
|