Home / Function/ Component() — react Function Reference

Component() — react Function Reference

Architecture documentation for the Component() function in error.invalid-reassign-local-variable-in-async-callback.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  56fed238_22af_a743_dd59_54fa5511caf2["Component()"]
  bcead1f2_aa5c_7567_462c_d747c1541428["error.invalid-reassign-local-variable-in-async-callback.js"]
  56fed238_22af_a743_dd59_54fa5511caf2 -->|defined in| bcead1f2_aa5c_7567_462c_d747c1541428
  style 56fed238_22af_a743_dd59_54fa5511caf2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-reassign-local-variable-in-async-callback.js lines 1–16

function Component() {
  let value = null;
  const reassign = async () => {
    await foo().then(result => {
      // Reassigning a local variable in an async function is *always* mutating
      // after render, so this should error regardless of where this ends up
      // getting called
      value = result;
    });
  };

  const onClick = async () => {
    await reassign();
  };
  return <div onClick={onClick}>Click</div>;
}

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/error.invalid-reassign-local-variable-in-async-callback.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-reassign-local-variable-in-async-callback.js at line 1.

Analyze Your Own Codebase

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

Try Supermodel Free