Home / Function/ Component() — react Function Reference

Component() — react Function Reference

Architecture documentation for the Component() function in maybe-mutate-object-in-callback.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  11309f32_8541_76a2_14af_ce3691fc0f72["Component()"]
  eea96db3_43a2_4f0f_154d_43490abb59c0["maybe-mutate-object-in-callback.js"]
  11309f32_8541_76a2_14af_ce3691fc0f72 -->|defined in| eea96db3_43a2_4f0f_154d_43490abb59c0
  style 11309f32_8541_76a2_14af_ce3691fc0f72 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/maybe-mutate-object-in-callback.js lines 3–11

function Component(props) {
  const object = {};
  // We optimistically assume function calls within callbacks don't mutate (unless the function
  // is known to be called during render), so this should get memoized
  const onClick = () => {
    mutate(object);
  };
  return <Foo callback={onClick}>{props.children}</Foo>;
}

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/maybe-mutate-object-in-callback.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/maybe-mutate-object-in-callback.js at line 3.

Analyze Your Own Codebase

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

Try Supermodel Free