Home / Function/ replayFunctionComponent() — react Function Reference

replayFunctionComponent() — react Function Reference

Architecture documentation for the replayFunctionComponent() function in ReactFiberBeginWork.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  dfac1880_449a_ca3a_3037_ca7205fa8fa7["replayFunctionComponent()"]
  0be70812_cc0c_b210_f84f_8e61dd5f831c["ReactFiberBeginWork.js"]
  dfac1880_449a_ca3a_3037_ca7205fa8fa7 -->|defined in| 0be70812_cc0c_b210_f84f_8e61dd5f831c
  1df0dd5b_17c8_c98c_3521_17154496ef7a["markComponentRenderStarted()"]
  dfac1880_449a_ca3a_3037_ca7205fa8fa7 -->|calls| 1df0dd5b_17c8_c98c_3521_17154496ef7a
  c88117c7_b46d_b4e4_536c_462d4e08c01e["markComponentRenderStopped()"]
  dfac1880_449a_ca3a_3037_ca7205fa8fa7 -->|calls| c88117c7_b46d_b4e4_536c_462d4e08c01e
  6cb202e6_76dc_0479_ff31_d0ef23610882["bailoutOnAlreadyFinishedWork()"]
  dfac1880_449a_ca3a_3037_ca7205fa8fa7 -->|calls| 6cb202e6_76dc_0479_ff31_d0ef23610882
  dae8f65a_04a5_194b_7c97_c4819e519207["getIsHydrating()"]
  dfac1880_449a_ca3a_3037_ca7205fa8fa7 -->|calls| dae8f65a_04a5_194b_7c97_c4819e519207
  cf5641cc_b89e_d6b2_5d40_41ad5bbdd682["reconcileChildren()"]
  dfac1880_449a_ca3a_3037_ca7205fa8fa7 -->|calls| cf5641cc_b89e_d6b2_5d40_41ad5bbdd682
  style dfac1880_449a_ca3a_3037_ca7205fa8fa7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-reconciler/src/ReactFiberBeginWork.js lines 1533–1574

export function replayFunctionComponent(
  current: Fiber | null,
  workInProgress: Fiber,
  nextProps: any,
  Component: any,
  secondArg: any,
  renderLanes: Lanes,
): Fiber | null {
  // This function is used to replay a component that previously suspended,
  // after its data resolves. It's a simplified version of
  // updateFunctionComponent that reuses the hooks from the previous attempt.

  prepareToReadContext(workInProgress, renderLanes);
  if (enableSchedulingProfiler) {
    markComponentRenderStarted(workInProgress);
  }
  const nextChildren = replaySuspendedComponentWithHooks(
    current,
    workInProgress,
    Component,
    nextProps,
    secondArg,
  );
  const hasId = checkDidRenderIdHook();
  if (enableSchedulingProfiler) {
    markComponentRenderStopped();
  }

  if (current !== null && !didReceiveUpdate) {
    bailoutHooks(current, workInProgress, renderLanes);
    return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
  }

  if (getIsHydrating() && hasId) {
    pushMaterializedTreeId(workInProgress);
  }

  // React DevTools reads this flag.
  workInProgress.flags |= PerformedWork;
  reconcileChildren(current, workInProgress, nextChildren, renderLanes);
  return workInProgress.child;
}

Domain

Subdomains

Frequently Asked Questions

What does replayFunctionComponent() do?
replayFunctionComponent() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberBeginWork.js.
Where is replayFunctionComponent() defined?
replayFunctionComponent() is defined in packages/react-reconciler/src/ReactFiberBeginWork.js at line 1533.
What does replayFunctionComponent() call?
replayFunctionComponent() calls 5 function(s): bailoutOnAlreadyFinishedWork, getIsHydrating, markComponentRenderStarted, markComponentRenderStopped, reconcileChildren.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free