Home / Function/ Component() — react Function Reference

Component() — react Function Reference

Architecture documentation for the Component() function in error.todo-useCallback-set-ref-nested-property-ref-modified-later-preserve-memoization.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  20f6b49b_3b3f_36b4_96c3_6285c37471a6["Component()"]
  ee8869ab_85c6_3e7c_1e36_17279cafadc5["error.todo-useCallback-set-ref-nested-property-ref-modified-later-preserve-memoization.js"]
  20f6b49b_3b3f_36b4_96c3_6285c37471a6 -->|defined in| ee8869ab_85c6_3e7c_1e36_17279cafadc5
  style 20f6b49b_3b3f_36b4_96c3_6285c37471a6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-useCallback-set-ref-nested-property-ref-modified-later-preserve-memoization.js lines 4–17

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;
  });

  // The ref is modified later, extending its range and preventing memoization of onChange
  ref.current.inner = null;

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

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.todo-useCallback-set-ref-nested-property-ref-modified-later-preserve-memoization.js.
Where is Component() defined?
Component() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-useCallback-set-ref-nested-property-ref-modified-later-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