Home / File/ error.invalid-exhaustive-deps.js — react Source File

error.invalid-exhaustive-deps.js — react Source File

Architecture documentation for error.invalid-exhaustive-deps.js, a javascript file in the react codebase. 2 imports, 0 dependents.

File javascript TestingUtilities Fixtures 2 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  c06fcdfc_03cd_64e6_1bee_b725d6676bb2["error.invalid-exhaustive-deps.js"]
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  c06fcdfc_03cd_64e6_1bee_b725d6676bb2 --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  006eec3d_77a9_4a47_e6c1_a96d7a6c9c05["shared-runtime"]
  c06fcdfc_03cd_64e6_1bee_b725d6676bb2 --> 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05
  style c06fcdfc_03cd_64e6_1bee_b725d6676bb2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// @validateExhaustiveMemoizationDependencies
import {useMemo} from 'react';
import {Stringify} from 'shared-runtime';

function Component({x, y, z}) {
  const a = useMemo(() => {
    return x?.y.z?.a;
    // error: too precise
  }, [x?.y.z?.a.b]);
  const b = useMemo(() => {
    return x.y.z?.a;
    // ok, not our job to type check nullability
  }, [x.y.z.a]);
  const c = useMemo(() => {
    return x?.y.z.a?.b;
    // error: too precise
  }, [x?.y.z.a?.b.z]);
  const d = useMemo(() => {
    return x?.y?.[(console.log(y), z?.b)];
    // ok
  }, [x?.y, y, z?.b]);
  const e = useMemo(() => {
    const e = [];
    e.push(x);
    return e;
    // ok
  }, [x]);
  const f = useMemo(() => {
    return [];
    // error: unnecessary
  }, [x, y.z, z?.y?.a, UNUSED_GLOBAL]);
  const ref1 = useRef(null);
  const ref2 = useRef(null);
  const ref = z ? ref1 : ref2;
  const cb = useMemo(() => {
    return () => {
      return ref.current;
    };
    // error: ref is a stable type but reactive
  }, []);
  return <Stringify results={[a, b, c, d, e, f, cb]} />;
}

Subdomains

Functions

Dependencies

  • react
  • shared-runtime

Frequently Asked Questions

What does error.invalid-exhaustive-deps.js do?
error.invalid-exhaustive-deps.js is a source file in the react codebase, written in javascript. It belongs to the TestingUtilities domain, Fixtures subdomain.
What functions are defined in error.invalid-exhaustive-deps.js?
error.invalid-exhaustive-deps.js defines 1 function(s): Component.
What does error.invalid-exhaustive-deps.js depend on?
error.invalid-exhaustive-deps.js imports 2 module(s): react, shared-runtime.
Where is error.invalid-exhaustive-deps.js in the architecture?
error.invalid-exhaustive-deps.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/exhaustive-deps/error.invalid-exhaustive-deps.js (domain: TestingUtilities, subdomain: Fixtures, directory: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/exhaustive-deps).

Analyze Your Own Codebase

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

Try Supermodel Free