Home / Function/ Component() — react Function Reference

Component() — react Function Reference

Architecture documentation for the Component() function in error.invalid-mutate-global-in-render-helper-prop.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  7f988dee_b1ce_9e4b_fb2e_7280e44f6067["Component()"]
  30c10e9e_c05d_83ab_0c58_4bac6935e648["error.invalid-mutate-global-in-render-helper-prop.js"]
  7f988dee_b1ce_9e4b_fb2e_7280e44f6067 -->|defined in| 30c10e9e_c05d_83ab_0c58_4bac6935e648
  style 7f988dee_b1ce_9e4b_fb2e_7280e44f6067 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-mutate-global-in-render-helper-prop.js lines 1–12

function Component() {
  const renderItem = item => {
    // Normally we assume that it's safe to mutate globals in a function passed
    // as a prop, because the prop could be used as an event handler or effect.
    // But if the function returns JSX we can assume it's a render helper, ie
    // called during render, and thus it's unsafe to mutate globals or call
    // other impure code.
    global.property = true;
    return <Item item={item} value={rand} />;
  };
  return <ItemList renderItem={renderItem} />;
}

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-mutate-global-in-render-helper-prop.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-mutate-global-in-render-helper-prop.js at line 1.

Analyze Your Own Codebase

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

Try Supermodel Free