Home / Type/ Kind Type — react Architecture

Kind Type — react Architecture

Architecture documentation for the Kind type/interface in ValidateHooksUsage.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  29a951c7_af4f_654e_2325_ef62aaccd09b["Kind"]
  0aa1377a_e69b_36ae_b83d_c842baa2ad42["ValidateHooksUsage.ts"]
  29a951c7_af4f_654e_2325_ef62aaccd09b -->|defined in| 0aa1377a_e69b_36ae_b83d_c842baa2ad42
  style 29a951c7_af4f_654e_2325_ef62aaccd09b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateHooksUsage.ts lines 36–64

enum Kind {
  // A potential/known hook which was already used in an invalid way
  Error = 'Error',

  /*
   * A known hook. Sources include:
   * - LoadGlobal instructions whose type was inferred as a hook
   * - PropertyLoad, ComputedLoad, and Destructuring instructions
   *   where the object is a KnownHook
   * - PropertyLoad, ComputedLoad, and Destructuring instructions
   *   where the object is a Global and the property name is hook-like
   */
  KnownHook = 'KnownHook',

  /*
   * A potential hook. Sources include:
   * - LValues (other than LoadGlobal) where the name is hook-like
   * - PropertyLoad, ComputedLoad, and Destructuring instructions
   *   where the object is a potential hook or the property name
   *   is hook-like
   */
  PotentialHook = 'PotentialHook',

  // LoadGlobal values whose type was not inferred as a hook
  Global = 'Global',

  // All other values, ie local variables
  Local = 'Local',
}

Frequently Asked Questions

What is the Kind type?
Kind is a type/interface in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateHooksUsage.ts.
Where is Kind defined?
Kind is defined in compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateHooksUsage.ts at line 36.

Analyze Your Own Codebase

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

Try Supermodel Free