Home / File/ ReactSymbols.js — react Source File

ReactSymbols.js — react Source File

Architecture documentation for ReactSymbols.js, a javascript file in the react codebase. 0 imports, 2 dependents.

File javascript BabelCompiler Entrypoint 2 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  83d2fbad_2242_aa75_e397_ad184684aed6["ReactSymbols.js"]
  b0d758a8_615d_45ad_e2e2_843278426960["ReactPerformanceTrackProperties.js"]
  b0d758a8_615d_45ad_e2e2_843278426960 --> 83d2fbad_2242_aa75_e397_ad184684aed6
  790f4fc6_487b_b503_14ee_da20fdae5896["ReactTypes.js"]
  790f4fc6_487b_b503_14ee_da20fdae5896 --> 83d2fbad_2242_aa75_e397_ad184684aed6
  style 83d2fbad_2242_aa75_e397_ad184684aed6 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.
 *
 * @flow
 */

// ATTENTION
// When adding new symbols to this file,
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'

// The Symbol used to tag the ReactElement-like types.
export const REACT_LEGACY_ELEMENT_TYPE: symbol = Symbol.for('react.element');
export const REACT_ELEMENT_TYPE: symbol = Symbol.for(
  'react.transitional.element',
);
export const REACT_PORTAL_TYPE: symbol = Symbol.for('react.portal');
export const REACT_FRAGMENT_TYPE: symbol = Symbol.for('react.fragment');
export const REACT_STRICT_MODE_TYPE: symbol = Symbol.for('react.strict_mode');
export const REACT_PROFILER_TYPE: symbol = Symbol.for('react.profiler');
export const REACT_CONSUMER_TYPE: symbol = Symbol.for('react.consumer');
export const REACT_CONTEXT_TYPE: symbol = Symbol.for('react.context');
export const REACT_FORWARD_REF_TYPE: symbol = Symbol.for('react.forward_ref');
export const REACT_SUSPENSE_TYPE: symbol = Symbol.for('react.suspense');
export const REACT_SUSPENSE_LIST_TYPE: symbol = Symbol.for(
  'react.suspense_list',
);
export const REACT_MEMO_TYPE: symbol = Symbol.for('react.memo');
export const REACT_LAZY_TYPE: symbol = Symbol.for('react.lazy');
export const REACT_SCOPE_TYPE: symbol = Symbol.for('react.scope');
export const REACT_ACTIVITY_TYPE: symbol = Symbol.for('react.activity');
export const REACT_LEGACY_HIDDEN_TYPE: symbol = Symbol.for(
  'react.legacy_hidden',
);
export const REACT_TRACING_MARKER_TYPE: symbol = Symbol.for(
  'react.tracing_marker',
);

export const REACT_MEMO_CACHE_SENTINEL: symbol = Symbol.for(
  'react.memo_cache_sentinel',
);

export const REACT_VIEW_TRANSITION_TYPE: symbol = Symbol.for(
  'react.view_transition',
);

const MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
const FAUX_ITERATOR_SYMBOL = '@@iterator';

export function getIteratorFn(maybeIterable: ?any): ?() => ?Iterator<any> {
  if (maybeIterable === null || typeof maybeIterable !== 'object') {
    return null;
  }
  const maybeIterator =
    (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
    maybeIterable[FAUX_ITERATOR_SYMBOL];
  if (typeof maybeIterator === 'function') {
    return maybeIterator;
  }
  return null;
}

export const ASYNC_ITERATOR = Symbol.asyncIterator;

export const REACT_OPTIMISTIC_KEY: ReactOptimisticKey = (Symbol.for(
  'react.optimistic_key',
): any);

// This is actually a symbol but Flow doesn't support comparison of symbols to refine.
// We use a boolean since in our code we often expect string (key) or number (index),
// so by pretending to be a boolean we cover a lot of cases that don't consider this case.
export type ReactOptimisticKey = true;

Domain

Subdomains

Functions

Frequently Asked Questions

What does ReactSymbols.js do?
ReactSymbols.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Entrypoint subdomain.
What functions are defined in ReactSymbols.js?
ReactSymbols.js defines 1 function(s): getIteratorFn.
What files import ReactSymbols.js?
ReactSymbols.js is imported by 2 file(s): ReactPerformanceTrackProperties.js, ReactTypes.js.
Where is ReactSymbols.js in the architecture?
ReactSymbols.js is located at packages/shared/ReactSymbols.js (domain: BabelCompiler, subdomain: Entrypoint, directory: packages/shared).

Analyze Your Own Codebase

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

Try Supermodel Free