Home / Function/ isInsideComponentOrHook() — react Function Reference

isInsideComponentOrHook() — react Function Reference

Architecture documentation for the isInsideComponentOrHook() function in RulesOfHooks.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  e33d7f9c_2333_764f_8ca1_79868b065cbf["isInsideComponentOrHook()"]
  47fb9f02_49dd_1d0d_5027_9353a6a77f1e["RulesOfHooks.ts"]
  e33d7f9c_2333_764f_8ca1_79868b065cbf -->|defined in| 47fb9f02_49dd_1d0d_5027_9353a6a77f1e
  be7612d8_31aa_c40a_35d5_89fd476ab28a["rule.create()"]
  be7612d8_31aa_c40a_35d5_89fd476ab28a -->|calls| e33d7f9c_2333_764f_8ca1_79868b065cbf
  8602459e_8564_b68b_f89f_016bed3c8ea4["getFunctionName()"]
  e33d7f9c_2333_764f_8ca1_79868b065cbf -->|calls| 8602459e_8564_b68b_f89f_016bed3c8ea4
  89d4f39b_deac_2a1d_4844_63ce247622ec["isComponentName()"]
  e33d7f9c_2333_764f_8ca1_79868b065cbf -->|calls| 89d4f39b_deac_2a1d_4844_63ce247622ec
  3fc9f24c_035f_b907_304f_45903ee4e5d7["isHook()"]
  e33d7f9c_2333_764f_8ca1_79868b065cbf -->|calls| 3fc9f24c_035f_b907_304f_45903ee4e5d7
  570b7e73_2c19_4f41_d9ef_4540eb990f99["isForwardRefCallback()"]
  e33d7f9c_2333_764f_8ca1_79868b065cbf -->|calls| 570b7e73_2c19_4f41_d9ef_4540eb990f99
  c846db86_f5e0_0014_473e_35406d2b6173["isMemoCallback()"]
  e33d7f9c_2333_764f_8ca1_79868b065cbf -->|calls| c846db86_f5e0_0014_473e_35406d2b6173
  style e33d7f9c_2333_764f_8ca1_79868b065cbf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/eslint-plugin-react-hooks/src/rules/RulesOfHooks.ts lines 98–112

function isInsideComponentOrHook(node: Node | undefined): boolean {
  while (node) {
    const functionName = getFunctionName(node);
    if (functionName) {
      if (isComponentName(functionName) || isHook(functionName)) {
        return true;
      }
    }
    if (isForwardRefCallback(node) || isMemoCallback(node)) {
      return true;
    }
    node = node.parent;
  }
  return false;
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does isInsideComponentOrHook() do?
isInsideComponentOrHook() is a function in the react codebase, defined in packages/eslint-plugin-react-hooks/src/rules/RulesOfHooks.ts.
Where is isInsideComponentOrHook() defined?
isInsideComponentOrHook() is defined in packages/eslint-plugin-react-hooks/src/rules/RulesOfHooks.ts at line 98.
What does isInsideComponentOrHook() call?
isInsideComponentOrHook() calls 5 function(s): getFunctionName, isComponentName, isForwardRefCallback, isHook, isMemoCallback.
What calls isInsideComponentOrHook()?
isInsideComponentOrHook() is called by 1 function(s): rule.create.

Analyze Your Own Codebase

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

Try Supermodel Free