Home / Function/ declare() — react Function Reference

declare() — react Function Reference

Architecture documentation for the declare() function in PropagateScopeDependenciesHIR.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  97736ed1_9768_bb5a_276e_d5b04a417908["declare()"]
  1be3b542_2ecf_364c_adef_6e5675b7385e["DependencyCollectionContext"]
  97736ed1_9768_bb5a_276e_d5b04a417908 -->|defined in| 1be3b542_2ecf_364c_adef_6e5675b7385e
  fe7b2dbb_34c7_f07a_c558_c479a9c5eb1e["handleInstruction()"]
  fe7b2dbb_34c7_f07a_c558_c479a9c5eb1e -->|calls| 97736ed1_9768_bb5a_276e_d5b04a417908
  5b709ffb_65e9_2125_d608_a351c667cd6c["collectDependencies()"]
  5b709ffb_65e9_2125_d608_a351c667cd6c -->|calls| 97736ed1_9768_bb5a_276e_d5b04a417908
  f523a4df_e5a4_d8d8_dbd0_ef75659ea0a5["inferDependencies()"]
  f523a4df_e5a4_d8d8_dbd0_ef75659ea0a5 -->|calls| 97736ed1_9768_bb5a_276e_d5b04a417908
  ad17cc28_c934_cf1a_ce40_409d2c34592d["inferDependenciesInFn()"]
  ad17cc28_c934_cf1a_ce40_409d2c34592d -->|calls| 97736ed1_9768_bb5a_276e_d5b04a417908
  style 97736ed1_9768_bb5a_276e_d5b04a417908 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/HIR/PropagateScopeDependenciesHIR.ts lines 477–483

  declare(identifier: Identifier, decl: Decl): void {
    if (this.#innerFnContext != null) return;
    if (!this.#declarations.has(identifier.declarationId)) {
      this.#declarations.set(identifier.declarationId, decl);
    }
    this.#reassignments.set(identifier, decl);
  }

Subdomains

Frequently Asked Questions

What does declare() do?
declare() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/PropagateScopeDependenciesHIR.ts.
Where is declare() defined?
declare() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/PropagateScopeDependenciesHIR.ts at line 477.
What calls declare()?
declare() is called by 4 function(s): collectDependencies, handleInstruction, inferDependencies, inferDependenciesInFn.

Analyze Your Own Codebase

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

Try Supermodel Free