MCPcopy Index your code
hub / github.com/react/react / mapRemainingChildren

Function mapRemainingChildren

packages/react-reconciler/src/ReactChildFiber.js:463–481  ·  view source on GitHub ↗
(
    currentFirstChild: Fiber,
  )

Source from the content-addressed store, hash-verified

461 }
462
463 function mapRemainingChildren(
464 currentFirstChild: Fiber,
465 ): Map<string | number, Fiber> {
466 // Add the remaining children to a temporary map so that we can find them by
467 // keys quickly. Implicit (null) keys get added to this set with their index
468 // instead.
469 const existingChildren: Map<string | number, Fiber> = new Map();
470
471 let existingChild: null | Fiber = currentFirstChild;
472 while (existingChild !== null) {
473 if (existingChild.key !== null) {
474 existingChildren.set(existingChild.key, existingChild);
475 } else {
476 existingChildren.set(existingChild.index, existingChild);
477 }
478 existingChild = existingChild.sibling;
479 }
480 return existingChildren;
481 }
482
483 function useFiber(fiber: Fiber, pendingProps: mixed): Fiber {
484 // We currently set sibling to null and index to 0 here because it is easy

Callers 2

reconcileChildrenArrayFunction · 0.85

Calls 1

setMethod · 0.80

Tested by

no test coverage detected