Home / Function/ findAncestor() — react Function Reference

findAncestor() — react Function Reference

Architecture documentation for the findAncestor() function in validateDOMNesting.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  efcb6d17_b35d_e8c2_bc5c_34ef4aeaa0a1["findAncestor()"]
  99b6f05f_c8d3_afa4_842b_34ebebb1f8a7["validateDOMNesting.js"]
  efcb6d17_b35d_e8c2_bc5c_34ef4aeaa0a1 -->|defined in| 99b6f05f_c8d3_afa4_842b_34ebebb1f8a7
  96e5c4d9_bcbf_86ea_69bb_cc3d02fbd794["validateDOMNesting()"]
  96e5c4d9_bcbf_86ea_69bb_cc3d02fbd794 -->|calls| efcb6d17_b35d_e8c2_bc5c_34ef4aeaa0a1
  9805d2a0_a12e_fb58_a873_c63b02425b81["validateTextNesting()"]
  9805d2a0_a12e_fb58_a873_c63b02425b81 -->|calls| efcb6d17_b35d_e8c2_bc5c_34ef4aeaa0a1
  style efcb6d17_b35d_e8c2_bc5c_34ef4aeaa0a1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-dom-bindings/src/client/validateDOMNesting.js lines 534–547

function findAncestor(parent: null | Fiber, tagName: string): null | Fiber {
  while (parent) {
    switch (parent.tag) {
      case HostComponent:
      case HostHoistable:
      case HostSingleton:
        if (parent.type === tagName) {
          return parent;
        }
    }
    parent = parent.return;
  }
  return null;
}

Domain

Subdomains

Frequently Asked Questions

What does findAncestor() do?
findAncestor() is a function in the react codebase, defined in packages/react-dom-bindings/src/client/validateDOMNesting.js.
Where is findAncestor() defined?
findAncestor() is defined in packages/react-dom-bindings/src/client/validateDOMNesting.js at line 534.
What calls findAncestor()?
findAncestor() is called by 2 function(s): validateDOMNesting, validateTextNesting.

Analyze Your Own Codebase

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

Try Supermodel Free