Home / Function/ Component() — react Function Reference

Component() — react Function Reference

Architecture documentation for the Component() function in function-expression-maybe-mutates-hook-return-value.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  f5fd9210_eabe_5a40_15a0_99088fbca5b8["Component()"]
  f0ab1784_ef7c_ebd5_0a39_5c29de285fa6["function-expression-maybe-mutates-hook-return-value.js"]
  f5fd9210_eabe_5a40_15a0_99088fbca5b8 -->|defined in| f0ab1784_ef7c_ebd5_0a39_5c29de285fa6
  style f5fd9210_eabe_5a40_15a0_99088fbca5b8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/function-expression-maybe-mutates-hook-return-value.js lines 1–12

function Component(props) {
  const id = useSelectedEntitytId();
  // this example should infer `id` as mutable, and then infer `onLoad` as mutable,
  // and be rejected because onLoad cannot be passed as a frozen value in the JSX.
  // however, we likely have to allow this example to work, because hook return
  // values are generally immutable in practice and are also widely referenced in
  // callbacks.
  const onLoad = () => {
    log(id);
  };
  return <Foo onLoad={onLoad} />;
}

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/function-expression-maybe-mutates-hook-return-value.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/function-expression-maybe-mutates-hook-return-value.js at line 1.

Analyze Your Own Codebase

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

Try Supermodel Free