Home / Function/ callsHooksOrCreatesJsx() — react Function Reference

callsHooksOrCreatesJsx() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  91675464_ecf7_5d45_b9ac_a40f0b6d6c65["callsHooksOrCreatesJsx()"]
  90fd4a4d_9742_70a7_9512_f9dd5b565200["babel-plugin-annotate-react-code.ts"]
  91675464_ecf7_5d45_b9ac_a40f0b6d6c65 -->|defined in| 90fd4a4d_9742_70a7_9512_f9dd5b565200
  40539f87_cad8_e5ab_baf5_c8916ae353cf["isComponentOrHookLike()"]
  40539f87_cad8_e5ab_baf5_c8916ae353cf -->|calls| 91675464_ecf7_5d45_b9ac_a40f0b6d6c65
  4280acf5_f565_fbf1_6a6e_06da2024d5cf["isHook()"]
  91675464_ecf7_5d45_b9ac_a40f0b6d6c65 -->|calls| 4280acf5_f565_fbf1_6a6e_06da2024d5cf
  style 91675464_ecf7_5d45_b9ac_a40f0b6d6c65 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/scripts/babel-plugin-annotate-react-code.ts lines 213–229

function callsHooksOrCreatesJsx(node: NodePath<t.Node>): boolean {
  let invokesHooks = false;
  let createsJsx = false;
  node.traverse({
    JSX() {
      createsJsx = true;
    },
    CallExpression(call) {
      const callee = call.get('callee');
      if (callee.isExpression() && isHook(callee)) {
        invokesHooks = true;
      }
    },
  });

  return invokesHooks || createsJsx;
}

Subdomains

Calls

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free