Home / Function/ elementRefGetterWithDeprecationWarning() — react Function Reference

elementRefGetterWithDeprecationWarning() — react Function Reference

Architecture documentation for the elementRefGetterWithDeprecationWarning() function in ReactJSXElement.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  8c36d4a1_fc47_8b9c_49b6_eb5677558db0["elementRefGetterWithDeprecationWarning()"]
  1bf5591f_27a1_c79f_853a_6242549e0e07["ReactJSXElement.js"]
  8c36d4a1_fc47_8b9c_49b6_eb5677558db0 -->|defined in| 1bf5591f_27a1_c79f_853a_6242549e0e07
  style 8c36d4a1_fc47_8b9c_49b6_eb5677558db0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react/src/jsx/ReactJSXElement.js lines 143–160

function elementRefGetterWithDeprecationWarning() {
  if (__DEV__) {
    const componentName = getComponentNameFromType(this.type);
    if (!didWarnAboutElementRef[componentName]) {
      didWarnAboutElementRef[componentName] = true;
      console.error(
        'Accessing element.ref was removed in React 19. ref is now a ' +
          'regular prop. It will be removed from the JSX Element ' +
          'type in a future release.',
      );
    }

    // An undefined `element.ref` is coerced to `null` for
    // backwards compatibility.
    const refProp = this.props.ref;
    return refProp !== undefined ? refProp : null;
  }
}

Domain

Subdomains

Frequently Asked Questions

What does elementRefGetterWithDeprecationWarning() do?
elementRefGetterWithDeprecationWarning() is a function in the react codebase, defined in packages/react/src/jsx/ReactJSXElement.js.
Where is elementRefGetterWithDeprecationWarning() defined?
elementRefGetterWithDeprecationWarning() is defined in packages/react/src/jsx/ReactJSXElement.js at line 143.

Analyze Your Own Codebase

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

Try Supermodel Free