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
  0007f882_7308_290b_3dd1_9555b9f99d4f["get()"]
  ec73283c_3989_df3b_537d_60a9a8207e43["LRUCache"]
  0007f882_7308_290b_3dd1_9555b9f99d4f -->|defined in| ec73283c_3989_df3b_537d_60a9a8207e43
  a175348c_963a_8fa3_863b_f233ca6a33b6["runReactCompiler()"]
  a175348c_963a_8fa3_863b_f233ca6a33b6 -->|calls| 0007f882_7308_290b_3dd1_9555b9f99d4f
  style 0007f882_7308_290b_3dd1_9555b9f99d4f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/eslint-plugin-react-hooks/src/shared/RunReactCompiler.ts lines 275–293

  get(key: K): T | null {
    const 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 packages/eslint-plugin-react-hooks/src/shared/RunReactCompiler.ts.
Where is get() defined?
get() is defined in packages/eslint-plugin-react-hooks/src/shared/RunReactCompiler.ts at line 275.
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