getHookVariableName() — react Function Reference
Architecture documentation for the getHookVariableName() function in astUtils.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 75a8dada_c873_7ef4_b1b4_f06aa03e35cb["getHookVariableName()"] 22acaf1d_d624_cc04_9046_5e8603f3a58d["astUtils.js"] 75a8dada_c873_7ef4_b1b4_f06aa03e35cb -->|defined in| 22acaf1d_d624_cc04_9046_5e8603f3a58d 4b550904_a2c6_c391_cba6_f44de349ba07["getHookNameFromNode()"] 4b550904_a2c6_c391_cba6_f44de349ba07 -->|calls| 75a8dada_c873_7ef4_b1b4_f06aa03e35cb style 75a8dada_c873_7ef4_b1b4_f06aa03e35cb fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-devtools-shared/src/hooks/astUtils.js lines 285–300
function getHookVariableName(
hook: NodePath,
isCustomHook: boolean = false,
): string | null {
const nodeType = hook.node.id.type;
switch (nodeType) {
case AST_NODE_TYPES.ARRAY_PATTERN:
return !isCustomHook ? (hook.node.id.elements[0]?.name ?? null) : null;
case AST_NODE_TYPES.IDENTIFIER:
return hook.node.id.name;
default:
return null;
}
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does getHookVariableName() do?
getHookVariableName() is a function in the react codebase, defined in packages/react-devtools-shared/src/hooks/astUtils.js.
Where is getHookVariableName() defined?
getHookVariableName() is defined in packages/react-devtools-shared/src/hooks/astUtils.js at line 285.
What calls getHookVariableName()?
getHookVariableName() is called by 1 function(s): getHookNameFromNode.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free