1
0
Fork 0
Browse Source

vault backup: 2022-05-08 17:03:09

master
YuJian920 3 years ago
parent
commit
6020105d9e
  1. 17
      React 的源码深入/React 的流程解析 - Fiber 递归/React 的流程解析 - Fiber 递归.md

17
React 的源码深入/React 的流程解析 - Fiber 递归/React 的流程解析 - Fiber 递归.md

@ -10,7 +10,24 @@ Fiber 递归开始首先会交由 createWorkInProgress 函数生成 WorkInProgre
```javascript ```javascript
function createWorkInProgress(current, pendingProps) { function createWorkInProgress(current, pendingProps) {
if (workInProgress === null) {
workInProgress = createFiber(
current.tag,
pendingProps,
current.key,
current.mode
);
// 赋值同名属性
workInProgress.elementType = current.elementType;
workInProgress.type = current.type;
workInProgress.stateNode = current.stateNode;
// 通过 alternate 属性互相链接
workInProgress.alternate = current;
current.alternate = workInProgress;
}
......
} }
``` ```

Loading…
Cancel
Save