Home / Function/ Component() — react Function Reference

Component() — react Function Reference

Architecture documentation for the Component() function in inadvertent-mutability-readonly-lambda.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  8c9a69c6_1dc3_cfe1_65b6_71374cbeb5d8["Component()"]
  3bcd6bb6_ded6_0a3d_c016_1c10195f80e9["inadvertent-mutability-readonly-lambda.js"]
  8c9a69c6_1dc3_cfe1_65b6_71374cbeb5d8 -->|defined in| 3bcd6bb6_ded6_0a3d_c016_1c10195f80e9
  style 8c9a69c6_1dc3_cfe1_65b6_71374cbeb5d8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inadvertent-mutability-readonly-lambda.js lines 1–13

function Component(props) {
  const [value, setValue] = useState(null);
  // NOTE: this lambda does not capture any mutable values (only the state setter)
  // and thus should be treated as readonly
  const onChange = e => setValue(value => value + e.target.value);

  useOtherHook();

  // x should be independently memoizeable, since foo(x, onChange) cannot modify onChange
  const x = {};
  foo(x, onChange);
  return x;
}

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/inadvertent-mutability-readonly-lambda.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inadvertent-mutability-readonly-lambda.js at line 1.

Analyze Your Own Codebase

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

Try Supermodel Free