Home / Function/ Component() — react Function Reference

Component() — react Function Reference

Architecture documentation for the Component() function in useMemo-mabye-modified-free-variable-preserve-memoization-guarantees.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  1b9b9c73_012f_7ea6_bda5_5bccaa25789b["Component()"]
  aceb0000_0c66_d7a3_8035_c5c0c0f65435["useMemo-mabye-modified-free-variable-preserve-memoization-guarantees.js"]
  1b9b9c73_012f_7ea6_bda5_5bccaa25789b -->|defined in| aceb0000_0c66_d7a3_8035_c5c0c0f65435
  style 1b9b9c73_012f_7ea6_bda5_5bccaa25789b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useMemo-mabye-modified-free-variable-preserve-memoization-guarantees.js lines 5–28

function Component(props) {
  // With the feature enabled these variables are inferred as frozen as of
  // the useMemo call
  const free = makeObject_Primitives();
  const free2 = makeObject_Primitives();
  const part = free2.part;

  // Thus their mutable range ends prior to this hook call, and both the above
  // values and the useMemo block value can be memoized
  useHook();

  const object = useMemo(() => {
    const x = makeObject_Primitives();
    x.value = props.value;
    mutate(x, free, part);
    return x;
  }, [props.value, free, part]);

  // These calls should be inferred as non-mutating due to the above freeze inference
  identity(free);
  identity(part);

  return object;
}

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/useMemo-mabye-modified-free-variable-preserve-memoization-guarantees.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useMemo-mabye-modified-free-variable-preserve-memoization-guarantees.js at line 5.

Analyze Your Own Codebase

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

Try Supermodel Free