1
0
Fork 0
Browse Source

vault backup: 2022-06-28 16:34:23

master
YuJian 2 years ago
parent
commit
41c0d2ebae
  1. 25
      React 的深入探索/React 的流程解析 - Fiber 递归/React 的深入探索 - beginWork.md

25
React 的深入探索/React 的流程解析 - Fiber 递归/React 的深入探索 - beginWork.md

@ -161,6 +161,8 @@ switch 中的 case 逻辑太多了,全部都写出来会让笔记显得特别 @@ -161,6 +161,8 @@ switch 中的 case 逻辑太多了,全部都写出来会让笔记显得特别
### updateHostRoot
首先会执行 pushHostRootContext 函数,这个函数与 context 有关
```javascript
function updateHostRoot(current, workInProgress, renderLanes) {
pushHostRootContext(workInProgress);
@ -168,9 +170,30 @@ function updateHostRoot(current, workInProgress, renderLanes) { @@ -168,9 +170,30 @@ function updateHostRoot(current, workInProgress, renderLanes) {
if (current === null || updateQueue === null) {
throw new Error("...");
}
var nextProps = workInProgress.pendingProps;
var prevState = workInProgress.memoizedState;
var prevChildren = prevState.element;
var prevChildren = prevState.element;
cloneUpdateQueue(current, workInProgress);
processUpdateQueue(workInProgress, nextProps, null, renderLanes);
var nextState = workInProgress.memoizedState;
var root = workInProgress.stateNode;
{
var nextCache = nextState.cache;
pushRootCachePool(root);
pushCacheProvider(workInProgress, nextCache);
if (nextCache !== prevState.cache) {
propagateContextChange(
workInProgress,
CacheContext,
renderLanes
);
}
}
......
}
```

Loading…
Cancel
Save