Home / Function/ shouldVisit() — react Function Reference

shouldVisit() — react Function Reference

Architecture documentation for the shouldVisit() function in babel-plugin-annotate-react-code.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  885dabed_4ea6_4b50_13ff_6ab9e94c743c["shouldVisit()"]
  90fd4a4d_9742_70a7_9512_f9dd5b565200["babel-plugin-annotate-react-code.ts"]
  885dabed_4ea6_4b50_13ff_6ab9e94c743c -->|defined in| 90fd4a4d_9742_70a7_9512_f9dd5b565200
  5269e169_1dd4_8259_43a8_57511e747ea4["annotate()"]
  5269e169_1dd4_8259_43a8_57511e747ea4 -->|calls| 885dabed_4ea6_4b50_13ff_6ab9e94c743c
  7a49857c_9cb2_3f7a_61c3_a3ecf2d8d15b["isComponentDeclaration()"]
  885dabed_4ea6_4b50_13ff_6ab9e94c743c -->|calls| 7a49857c_9cb2_3f7a_61c3_a3ecf2d8d15b
  40539f87_cad8_e5ab_baf5_c8916ae353cf["isComponentOrHookLike()"]
  885dabed_4ea6_4b50_13ff_6ab9e94c743c -->|calls| 40539f87_cad8_e5ab_baf5_c8916ae353cf
  style 885dabed_4ea6_4b50_13ff_6ab9e94c743c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/scripts/babel-plugin-annotate-react-code.ts lines 46–53

function shouldVisit(fn: BabelFn): boolean {
  return (
    // Component declarations are known components
    (fn.isFunctionDeclaration() && isComponentDeclaration(fn.node)) ||
    // Otherwise check if this is a component or hook-like function
    isComponentOrHookLike(fn)
  );
}

Subdomains

Called By

Frequently Asked Questions

What does shouldVisit() do?
shouldVisit() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/scripts/babel-plugin-annotate-react-code.ts.
Where is shouldVisit() defined?
shouldVisit() is defined in compiler/packages/babel-plugin-react-compiler/scripts/babel-plugin-annotate-react-code.ts at line 46.
What does shouldVisit() call?
shouldVisit() calls 2 function(s): isComponentDeclaration, isComponentOrHookLike.
What calls shouldVisit()?
shouldVisit() is called by 1 function(s): annotate.

Analyze Your Own Codebase

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

Try Supermodel Free