Home / Function/ identifier() — react Function Reference

identifier() — react Function Reference

Architecture documentation for the identifier() function in DeriveMinimalDependenciesHIR.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  66e2b974_b614_49df_112b_4ddbd5350177["identifier()"]
  ce8ab5d9_db4b_3be5_3f9c_38fa68bcbaa1["ReactiveScopeDependencyTreeHIR"]
  66e2b974_b614_49df_112b_4ddbd5350177 -->|defined in| ce8ab5d9_db4b_3be5_3f9c_38fa68bcbaa1
  041ca752_10c1_3cda_1f5c_02f44a01310e["invariant()"]
  66e2b974_b614_49df_112b_4ddbd5350177 -->|calls| 041ca752_10c1_3cda_1f5c_02f44a01310e
  e7a01d7c_c128_be66_a07d_007952a380da["printIdentifier()"]
  66e2b974_b614_49df_112b_4ddbd5350177 -->|calls| e7a01d7c_c128_be66_a07d_007952a380da
  style 66e2b974_b614_49df_112b_4ddbd5350177 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/HIR/DeriveMinimalDependenciesHIR.ts lines 73–97

  static #getOrCreateRoot<T extends string>(
    identifier: Identifier,
    reactive: boolean,
    roots: Map<Identifier, TreeNode<T> & {reactive: boolean}>,
    defaultAccessType: T,
  ): TreeNode<T> {
    // roots can always be accessed unconditionally in JS
    let rootNode = roots.get(identifier);

    if (rootNode === undefined) {
      rootNode = {
        properties: new Map(),
        reactive,
        accessType: defaultAccessType,
      };
      roots.set(identifier, rootNode);
    } else {
      CompilerError.invariant(reactive === rootNode.reactive, {
        reason: '[DeriveMinimalDependenciesHIR] Conflicting reactive root flag',
        description: `Identifier ${printIdentifier(identifier)}`,
        loc: GeneratedSource,
      });
    }
    return rootNode;
  }

Subdomains

Frequently Asked Questions

What does identifier() do?
identifier() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/DeriveMinimalDependenciesHIR.ts.
Where is identifier() defined?
identifier() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/DeriveMinimalDependenciesHIR.ts at line 73.
What does identifier() call?
identifier() calls 2 function(s): invariant, printIdentifier.

Analyze Your Own Codebase

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

Try Supermodel Free