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

Function reconcileSingleTextNode

packages/react-reconciler/src/ReactChildFiber.js:1604–1632  ·  view source on GitHub ↗
(
    returnFiber: Fiber,
    currentFirstChild: Fiber | null,
    textContent: string,
    lanes: Lanes,
  )

Source from the content-addressed store, hash-verified

1602 }
1603
1604 function reconcileSingleTextNode(
1605 returnFiber: Fiber,
1606 currentFirstChild: Fiber | null,
1607 textContent: string,
1608 lanes: Lanes,
1609 ): Fiber {
1610 // There's no need to check for keys on text nodes since we don't have a
1611 // way to define them.
1612 if (currentFirstChild !== null && currentFirstChild.tag === HostText) {
1613 // We already have an existing node so let's just update it and delete
1614 // the rest.
1615 deleteRemainingChildren(returnFiber, currentFirstChild.sibling);
1616 const existing = useFiber(currentFirstChild, textContent);
1617 existing.return = returnFiber;
1618 return existing;
1619 }
1620 // The existing first child is not a text node so we need to create one
1621 // and delete the existing ones.
1622 deleteRemainingChildren(returnFiber, currentFirstChild);
1623 const created = createFiberFromText(textContent, returnFiber.mode, lanes);
1624 created.return = returnFiber;
1625 if (__DEV__) {
1626 // We treat the parent as the owner for stack purposes.
1627 created._debugOwner = returnFiber;
1628 created._debugTask = returnFiber._debugTask;
1629 created._debugInfo = currentDebugInfo;
1630 }
1631 return created;
1632 }
1633
1634 function reconcileSingleElement(
1635 returnFiber: Fiber,

Callers 1

reconcileChildFibersImplFunction · 0.85

Calls 3

createFiberFromTextFunction · 0.90
deleteRemainingChildrenFunction · 0.85
useFiberFunction · 0.85

Tested by

no test coverage detected