Home / Function/ getPotentialHookDeclarationsFromAST() — react Function Reference

getPotentialHookDeclarationsFromAST() — react Function Reference

Architecture documentation for the getPotentialHookDeclarationsFromAST() function in astUtils.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  1fcb15c0_e9b6_04cb_5be9_a3f60ec9471d["getPotentialHookDeclarationsFromAST()"]
  22acaf1d_d624_cc04_9046_5e8603f3a58d["astUtils.js"]
  1fcb15c0_e9b6_04cb_5be9_a3f60ec9471d -->|defined in| 22acaf1d_d624_cc04_9046_5e8603f3a58d
  ae74fc61_22de_3ac9_6314_d002de1a11ab["getHookName()"]
  ae74fc61_22de_3ac9_6314_d002de1a11ab -->|calls| 1fcb15c0_e9b6_04cb_5be9_a3f60ec9471d
  380887ba_dbe4_1ba6_7743_9a77aad37654["isPotentialHookDeclaration()"]
  1fcb15c0_e9b6_04cb_5be9_a3f60ec9471d -->|calls| 380887ba_dbe4_1ba6_7743_9a77aad37654
  style 1fcb15c0_e9b6_04cb_5be9_a3f60ec9471d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-shared/src/hooks/astUtils.js lines 302–314

function getPotentialHookDeclarationsFromAST(sourceAST: File): NodePath[] {
  const potentialHooksFound: NodePath[] = [];
  withSyncPerfMeasurements('traverse(sourceAST)', () =>
    traverse(sourceAST, {
      enter(path) {
        if (path.isVariableDeclarator() && isPotentialHookDeclaration(path)) {
          potentialHooksFound.push(path);
        }
      },
    }),
  );
  return potentialHooksFound;
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does getPotentialHookDeclarationsFromAST() do?
getPotentialHookDeclarationsFromAST() is a function in the react codebase, defined in packages/react-devtools-shared/src/hooks/astUtils.js.
Where is getPotentialHookDeclarationsFromAST() defined?
getPotentialHookDeclarationsFromAST() is defined in packages/react-devtools-shared/src/hooks/astUtils.js at line 302.
What does getPotentialHookDeclarationsFromAST() call?
getPotentialHookDeclarationsFromAST() calls 1 function(s): isPotentialHookDeclaration.
What calls getPotentialHookDeclarationsFromAST()?
getPotentialHookDeclarationsFromAST() is called by 1 function(s): getHookName.

Analyze Your Own Codebase

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

Try Supermodel Free