Home / Function/ get() — react Function Reference

get() — react Function Reference

Architecture documentation for the get() function in RunReactCompiler.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  0fac09e7_822b_b88a_a5c9_de0dee6ca194["get()"]
  a50d46f2_b369_20a9_cf24_127b30c7ff97["LRUCache"]
  0fac09e7_822b_b88a_a5c9_de0dee6ca194 -->|defined in| a50d46f2_b369_20a9_cf24_127b30c7ff97
  d4cd9aad_c1ae_8b32_c4af_ba2106ad7951["runReactCompiler()"]
  d4cd9aad_c1ae_8b32_c4af_ba2106ad7951 -->|calls| 0fac09e7_822b_b88a_a5c9_de0dee6ca194
  style 0fac09e7_822b_b88a_a5c9_de0dee6ca194 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/eslint-plugin-react-compiler/src/shared/RunReactCompiler.ts lines 172–190

  get(key: K): T | null {
    let idx = this.#values.findIndex(entry => entry[0] === key);
    // If found, move to front
    if (idx === this.#headIdx) {
      return this.#values[this.#headIdx][1] as T;
    } else if (idx < 0) {
      return null;
    }

    const entry: [K, T] = this.#values[idx] as [K, T];

    const len = this.#values.length;
    for (let i = 0; i < Math.min(idx, len - 1); i++) {
      this.#values[(this.#headIdx + i + 1) % len] =
        this.#values[(this.#headIdx + i) % len];
    }
    this.#values[this.#headIdx] = entry;
    return entry[1];
  }

Domain

Subdomains

Called By

Frequently Asked Questions

What does get() do?
get() is a function in the react codebase, defined in compiler/packages/eslint-plugin-react-compiler/src/shared/RunReactCompiler.ts.
Where is get() defined?
get() is defined in compiler/packages/eslint-plugin-react-compiler/src/shared/RunReactCompiler.ts at line 172.
What calls get()?
get() is called by 1 function(s): runReactCompiler.

Analyze Your Own Codebase

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

Try Supermodel Free