关于react.js:React-completeUnitOfWork

58次阅读

共计 603 个字符,预计需要花费 2 分钟才能阅读完成。

completeUnitOfWork: 失去要更新的 Fiber,造成链表

params

  1. unitOfWork

代码

if (returnFiber !== null && (returnFiber.flags & Incomplete) === NoFlags) {if (returnFiber.firstEffect === null) {returnFiber.firstEffect = completedWork.firstEffect;}

  if (completedWork.lastEffect !== null) {if (returnFiber.lastEffect !== null) {returnFiber.lastEffect.nextEffect = completedWork.firstEffect;}

    returnFiber.lastEffect = completedWork.lastEffect;
  }

  var flags = completedWork.flags;

  if (flags > PerformedWork) {if (returnFiber.lastEffect !== null) {returnFiber.lastEffect.nextEffect = completedWork;} else {returnFiber.firstEffect = completedWork;}

    returnFiber.lastEffect = completedWork;
  }
}

正文完
 0