MCPcopy
hub / github.com/facebook/react / reconcileChildren

Function reconcileChildren

packages/react-reconciler/src/ReactFiberBeginWork.js:341–372  ·  view source on GitHub ↗
(
  current: Fiber | null,
  workInProgress: Fiber,
  nextChildren: any,
  renderLanes: Lanes,
)

Source from the content-addressed store, hash-verified

339}
340
341export function reconcileChildren(
342 current: Fiber | null,
343 workInProgress: Fiber,
344 nextChildren: any,
345 renderLanes: Lanes,
346) {
347 if (current === null) {
348 // If this is a fresh new component that hasn't been rendered yet, we
349 // won't update its child set by applying minimal side-effects. Instead,
350 // we will add them all to the child before it gets rendered. That means
351 // we can optimize this reconciliation pass by not tracking side-effects.
352 workInProgress.child = mountChildFibers(
353 workInProgress,
354 null,
355 nextChildren,
356 renderLanes,
357 );
358 } else {
359 // If the current child is the same as the work in progress, it means that
360 // we haven't yet started any work on these children. Therefore, we use
361 // the clone algorithm to create a copy of all the current children.
362
363 // If we had any progressed work already, that is invalid at this point so
364 // let's throw it out.
365 workInProgress.child = reconcileChildFibers(
366 workInProgress,
367 current.child,
368 nextChildren,
369 renderLanes,
370 );
371 }
372}
373
374function forceUnmountCurrentAndReconcile(
375 current: Fiber,

Callers 15

updateForwardRefFunction · 0.85
updateOffscreenComponentFunction · 0.85
updateCacheComponentFunction · 0.85
updateFragmentFunction · 0.85
updateModeFunction · 0.85
updateProfilerFunction · 0.85
updateFunctionComponentFunction · 0.85
replayFunctionComponentFunction · 0.85
finishClassComponentFunction · 0.85
updateHostRootFunction · 0.85

Calls 1

reconcileChildFibersFunction · 0.90

Tested by

no test coverage detected