Home / Function/ Component() — react Function Reference

Component() — react Function Reference

Architecture documentation for the Component() function in allow-global-mutation-in-effect-indirect-usecallback.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  8bbb56d7_7431_719b_1b6d_02823e391d27["Component()"]
  c47247f6_846e_83c3_63ab_d45d5435f5ea["allow-global-mutation-in-effect-indirect-usecallback.js"]
  8bbb56d7_7431_719b_1b6d_02823e391d27 -->|defined in| c47247f6_846e_83c3_63ab_d45d5435f5ea
  style 8bbb56d7_7431_719b_1b6d_02823e391d27 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-global-mutation-in-effect-indirect-usecallback.js lines 6–21

function Component() {
  const [state, setState] = useState(someGlobal);

  const setGlobal = useCallback(() => {
    someGlobal.value = true;
  }, []);
  useEffect(() => {
    setGlobal();
  }, []);

  useEffect(() => {
    setState(someGlobal.value);
  }, [someGlobal]);

  return <div>{String(state)}</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/allow-global-mutation-in-effect-indirect-usecallback.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-global-mutation-in-effect-indirect-usecallback.js at line 6.

Analyze Your Own Codebase

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

Try Supermodel Free