current position:Home>React completeUnitOfWork

React completeUnitOfWork

2021-08-23 04:15:38 snowofcat

completeUnitOfWork: Get what to update Fiber, Form a linked list

params

  1. unitOfWork

Code

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;
  }
}

copyright notice
author[snowofcat],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2021/08/20210823041536548u.html

Random recommended