Home / Function/ Component() — react Function Reference

Component() — react Function Reference

Architecture documentation for the Component() function in repro-independently-memoized-property-load-for-method-call.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  fd5ae396_0278_f02e_c475_fc0b1cd7d789["Component()"]
  227b7db9_e448_d6a2_defb_df3e169524e7["repro-independently-memoized-property-load-for-method-call.js"]
  fd5ae396_0278_f02e_c475_fc0b1cd7d789 -->|defined in| 227b7db9_e448_d6a2_defb_df3e169524e7
  feb13398_31a8_55ff_bb3c_d256e6b2ecc2["useServerTime()"]
  fd5ae396_0278_f02e_c475_fc0b1cd7d789 -->|calls| feb13398_31a8_55ff_bb3c_d256e6b2ecc2
  9287677b_6103_82b4_cc31_a32483606552["render()"]
  fd5ae396_0278_f02e_c475_fc0b1cd7d789 -->|calls| 9287677b_6103_82b4_cc31_a32483606552
  style fd5ae396_0278_f02e_c475_fc0b1cd7d789 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-independently-memoized-property-load-for-method-call.js lines 2–19

function Component({label, highlightedItem}) {
  const serverTime = useServerTime();
  const highlight = new Highlight(highlightedItem);

  const time = serverTime.get();
  // subtle bit here: the binary expression infers the result of the call
  // as a primitive and not needing memoization. the logical is necessary
  // because without it there are no intermediate scopes which observe
  // the result of the binary expression, so its memoization can be pruned
  const timestampLabel = time / 1000 || label;

  return (
    <>
      {highlight.render()}
      {timestampLabel}
    </>
  );
}

Domain

Subdomains

Frequently Asked Questions

What does Component() do?
Component() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-independently-memoized-property-load-for-method-call.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-independently-memoized-property-load-for-method-call.js at line 2.
What does Component() call?
Component() calls 2 function(s): render, useServerTime.

Analyze Your Own Codebase

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

Try Supermodel Free