Home / Function/ Component() — react Function Reference

Component() — react Function Reference

Architecture documentation for the Component() function in useCallback-multiple-callbacks-modifying-same-ref-preserve-memoization.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  c44c461c_d3c2_a153_c5f6_23be919cfd51["Component()"]
  3fdb9c4d_3add_75a8_6368_99d556d7be6c["useCallback-multiple-callbacks-modifying-same-ref-preserve-memoization.js"]
  c44c461c_d3c2_a153_c5f6_23be919cfd51 -->|defined in| 3fdb9c4d_3add_75a8_6368_99d556d7be6c
  style c44c461c_d3c2_a153_c5f6_23be919cfd51 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useCallback-multiple-callbacks-modifying-same-ref-preserve-memoization.js lines 4–18

function Component(props) {
  const ref = useRef({inner: null});

  const onChange = useCallback(event => {
    // The ref should still be mutable here even though function deps are frozen in
    // @enablePreserveExistingMemoizationGuarantees mode
    ref.current.inner = event.target.value;
  });

  const onReset = useCallback(() => {
    ref.current.inner = null;
  });

  return <input onChange={onChange} onReset={onReset} />;
}

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/useCallback-multiple-callbacks-modifying-same-ref-preserve-memoization.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useCallback-multiple-callbacks-modifying-same-ref-preserve-memoization.js at line 4.

Analyze Your Own Codebase

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

Try Supermodel Free