Home / File/ index.ts — react Source File

index.ts — react Source File

Architecture documentation for index.ts, a typescript file in the react codebase. 1 imports, 0 dependents.

File typescript BabelCompiler Validation 1 imports 12 functions

Entity Profile

Dependency Diagram

graph LR
  e7e94027_87c5_661b_dd97_be583c709eb3["index.ts"]
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  e7e94027_87c5_661b_dd97_be583c709eb3 --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  style e7e94027_87c5_661b_dd97_be583c709eb3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

import * as React from 'react';

const {useRef, useEffect, isValidElement} = React;
const ReactSecretInternals =
  //@ts-ignore
  React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE ??
  //@ts-ignore
  React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;

type MemoCache = Array<number | typeof $empty>;

const $empty = Symbol.for('react.memo_cache_sentinel');

// Re-export React.c if present, otherwise fallback to the userspace polyfill for versions of React
// < 19.
export const c =
  // @ts-expect-error
  typeof React.__COMPILER_RUNTIME?.c === 'function'
    ? // @ts-expect-error
      React.__COMPILER_RUNTIME.c
    : function c(size: number) {
        return React.useMemo<Array<unknown>>(() => {
          const $ = new Array(size);
          for (let ii = 0; ii < size; ii++) {
            $[ii] = $empty;
          }
          // This symbol is added to tell the react devtools that this array is from
          // useMemoCache.
          // @ts-ignore
          $[$empty] = true;
          return $;
        }, []);
      };

const LazyGuardDispatcher: {[key: string]: (...args: Array<any>) => any} = {};
[
  'readContext',
  'useCallback',
  'useContext',
  'useEffect',
  'useImperativeHandle',
  'useInsertionEffect',
  'useLayoutEffect',
  'useMemo',
  'useReducer',
  'useRef',
  'useState',
  'useDebugValue',
  'useDeferredValue',
  'useTransition',
  'useMutableSource',
  'useSyncExternalStore',
  'useId',
// ... (358 more lines)

Domain

Subdomains

Dependencies

  • react

Frequently Asked Questions

What does index.ts do?
index.ts is a source file in the react codebase, written in typescript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in index.ts?
index.ts defines 12 function(s): $dispatcherGuard, $makeReadOnly, $reset, $structuralCheck, LazyGuardDispatcher, args, c, clearRenderCounterRegistry, registerRenderCounter, removeRenderCounter, and 2 more.
What does index.ts depend on?
index.ts imports 1 module(s): react.
Where is index.ts in the architecture?
index.ts is located at compiler/packages/react-compiler-runtime/src/index.ts (domain: BabelCompiler, subdomain: Validation, directory: compiler/packages/react-compiler-runtime/src).

Analyze Your Own Codebase

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

Try Supermodel Free