|
|
@ -2,6 +2,22 @@ |
|
|
|
|
|
|
|
|
|
|
|
[代码位置](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 |
|
|
|
|
|
|
|
if (workInProgress._debugNeedsRemount && current !== null) { |
|
|
|
|
|
|
|
return remountFiber( |
|
|
|
|
|
|
|
current, |
|
|
|
|
|
|
|
workInProgress, |
|
|
|
|
|
|
|
createFiberFromTypeAndProps( |
|
|
|
|
|
|
|
workInProgress.type, |
|
|
|
|
|
|
|
workInProgress.key, |
|
|
|
|
|
|
|
workInProgress.pendingProps, |
|
|
|
|
|
|
|
workInProgress._debugOwner || null, workInProgress.mode, |
|
|
|
|
|
|
|
workInProgress.lanes |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
第一段是针对开发环境的逻辑,先跳过 |
|
|
|
第一段是针对开发环境的逻辑,先跳过 |
|
|
|
|
|
|
|
|
|
|
|
在进入主要函数逻辑之前,会先进入一个对 current 的空值判断,这个 current 就是 React 双缓存机制中的 current Fiber 树的 Fiber 节点,然后进入 |
|
|
|
在进入主要函数逻辑之前,会先进入一个对 current 的空值判断,这个 current 就是 React 双缓存机制中的 current Fiber 树的 Fiber 节点,然后进入 |
|
|
|