Home / Function/ getElementType() — react Function Reference

getElementType() — react Function Reference

Architecture documentation for the getElementType() function in renderer.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  cc77e32e_65f2_bb71_c3b3_89c3ff8f9852["getElementType()"]
  27444ff2_8253_76db_da6c_4967b0d20cee["renderer.js"]
  cc77e32e_65f2_bb71_c3b3_89c3ff8f9852 -->|defined in| 27444ff2_8253_76db_da6c_4967b0d20cee
  2f227955_4f5b_a05f_26dc_975311221f5d["getChildren()"]
  2f227955_4f5b_a05f_26dc_975311221f5d -->|calls| cc77e32e_65f2_bb71_c3b3_89c3ff8f9852
  0bf1ec3e_7bcf_3a31_d050_f4e3bd960b04["attach()"]
  0bf1ec3e_7bcf_3a31_d050_f4e3bd960b04 -->|calls| cc77e32e_65f2_bb71_c3b3_89c3ff8f9852
  style cc77e32e_65f2_bb71_c3b3_89c3ff8f9852 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-shared/src/backend/legacy/renderer.js lines 86–102

function getElementType(internalInstance: InternalInstance): ElementType {
  // != used deliberately here to catch undefined and null
  if (internalInstance._currentElement != null) {
    const elementType = internalInstance._currentElement.type;
    if (typeof elementType === 'function') {
      const publicInstance = internalInstance.getPublicInstance();
      if (publicInstance !== null) {
        return ElementTypeClass;
      } else {
        return ElementTypeFunction;
      }
    } else if (typeof elementType === 'string') {
      return ElementTypeHostComponent;
    }
  }
  return ElementTypeOtherOrUnknown;
}

Domain

Subdomains

Frequently Asked Questions

What does getElementType() do?
getElementType() is a function in the react codebase, defined in packages/react-devtools-shared/src/backend/legacy/renderer.js.
Where is getElementType() defined?
getElementType() is defined in packages/react-devtools-shared/src/backend/legacy/renderer.js at line 86.
What calls getElementType()?
getElementType() is called by 2 function(s): attach, getChildren.

Analyze Your Own Codebase

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

Try Supermodel Free