|
|
|
@ -10,7 +10,24 @@ Fiber 递归开始首先会交由 createWorkInProgress 函数生成 WorkInProgre
@@ -10,7 +10,24 @@ Fiber 递归开始首先会交由 createWorkInProgress 函数生成 WorkInProgre
|
|
|
|
|
|
|
|
|
|
```javascript |
|
|
|
|
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; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
...... |
|
|
|
|
} |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|