Home / Function/ addHook() — react Function Reference

addHook() — react Function Reference

Architecture documentation for the addHook() function in ObjectShape.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  d0882928_65af_dce8_5416_84ed7f492587["addHook()"]
  58f81300_7c82_5086_3e10_e46b5f3ab04d["ObjectShape.ts"]
  d0882928_65af_dce8_5416_84ed7f492587 -->|defined in| 58f81300_7c82_5086_3e10_e46b5f3ab04d
  bec8431d_08f7_cef1_8a71_8be17fc7a31a["constructor()"]
  bec8431d_08f7_cef1_8a71_8be17fc7a31a -->|calls| d0882928_65af_dce8_5416_84ed7f492587
  b5df453b_1fe3_4bcb_9def_abba2aa3a9a4["installTypeConfig()"]
  b5df453b_1fe3_4bcb_9def_abba2aa3a9a4 -->|calls| d0882928_65af_dce8_5416_84ed7f492587
  4ba5c3ad_186f_8c38_7db0_a6d2e5ee2b25["getReanimatedModuleType()"]
  4ba5c3ad_186f_8c38_7db0_a6d2e5ee2b25 -->|calls| d0882928_65af_dce8_5416_84ed7f492587
  d48f103d_be9e_0e54_7379_d248244a3c09["createAnonId()"]
  d0882928_65af_dce8_5416_84ed7f492587 -->|calls| d48f103d_be9e_0e54_7379_d248244a3c09
  e3b73b76_4b2f_e1c7_6ea9_544f184a98e7["parseAliasingSignatureConfig()"]
  d0882928_65af_dce8_5416_84ed7f492587 -->|calls| e3b73b76_4b2f_e1c7_6ea9_544f184a98e7
  54994d7a_c3e1_1a38_0769_4562dd8f15b4["addShape()"]
  d0882928_65af_dce8_5416_84ed7f492587 -->|calls| 54994d7a_c3e1_1a38_0769_4562dd8f15b4
  style d0882928_65af_dce8_5416_84ed7f492587 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/HIR/ObjectShape.ts lines 90–110

export function addHook(
  registry: ShapeRegistry,
  fn: Omit<FunctionSignature, 'aliasing'> & {
    hookKind: HookKind;
    aliasing?: AliasingSignatureConfig | null | undefined;
  },
  id: string | null = null,
): FunctionType {
  const shapeId = id ?? createAnonId();
  const aliasing =
    fn.aliasing != null
      ? parseAliasingSignatureConfig(fn.aliasing, '<builtin>', GeneratedSource)
      : null;
  addShape(registry, shapeId, [], {...fn, aliasing});
  return {
    kind: 'Function',
    return: fn.returnType,
    shapeId,
    isConstructor: false,
  };
}

Subdomains

Frequently Asked Questions

What does addHook() do?
addHook() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/ObjectShape.ts.
Where is addHook() defined?
addHook() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/ObjectShape.ts at line 90.
What does addHook() call?
addHook() calls 3 function(s): addShape, createAnonId, parseAliasingSignatureConfig.
What calls addHook()?
addHook() is called by 3 function(s): constructor, getReanimatedModuleType, installTypeConfig.

Analyze Your Own Codebase

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

Try Supermodel Free