Home / File/ getComponentNameFromType.js — react Source File

getComponentNameFromType.js — react Source File

Architecture documentation for getComponentNameFromType.js, a javascript file in the react codebase. 4 imports, 1 dependents.

File javascript BabelCompiler Entrypoint 4 imports 1 dependents 3 functions

Entity Profile

Dependency Diagram

graph LR
  d1749588_72f0_305a_3ea3_ab196eddbd95["getComponentNameFromType.js"]
  5ad6f79c_881c_e23b_6bc1_b8deb7889805["ReactFeatureFlags.js"]
  d1749588_72f0_305a_3ea3_ab196eddbd95 --> 5ad6f79c_881c_e23b_6bc1_b8deb7889805
  ebbd7451_c238_0c5d_d01e_21d7c2d60653["ReactLazy"]
  d1749588_72f0_305a_3ea3_ab196eddbd95 --> ebbd7451_c238_0c5d_d01e_21d7c2d60653
  d8f20c67_f5fa_0f0a_c967_c41fd9ffce07["ReactTypes"]
  d1749588_72f0_305a_3ea3_ab196eddbd95 --> d8f20c67_f5fa_0f0a_c967_c41fd9ffce07
  e1e1de60_2be4_0643_45fb_e2c306735427["ReactSymbols"]
  d1749588_72f0_305a_3ea3_ab196eddbd95 --> e1e1de60_2be4_0643_45fb_e2c306735427
  b0d758a8_615d_45ad_e2e2_843278426960["ReactPerformanceTrackProperties.js"]
  b0d758a8_615d_45ad_e2e2_843278426960 --> d1749588_72f0_305a_3ea3_ab196eddbd95
  style d1749588_72f0_305a_3ea3_ab196eddbd95 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
 */

import type {LazyComponent} from 'react/src/ReactLazy';
import type {ReactContext, ReactConsumerType} from 'shared/ReactTypes';

import {
  REACT_CONTEXT_TYPE,
  REACT_CONSUMER_TYPE,
  REACT_FORWARD_REF_TYPE,
  REACT_FRAGMENT_TYPE,
  REACT_PORTAL_TYPE,
  REACT_MEMO_TYPE,
  REACT_PROFILER_TYPE,
  REACT_STRICT_MODE_TYPE,
  REACT_SUSPENSE_TYPE,
  REACT_SUSPENSE_LIST_TYPE,
  REACT_LAZY_TYPE,
  REACT_TRACING_MARKER_TYPE,
  REACT_VIEW_TRANSITION_TYPE,
  REACT_ACTIVITY_TYPE,
} from 'shared/ReactSymbols';

import {
  enableTransitionTracing,
  enableViewTransition,
} from './ReactFeatureFlags';

// Keep in sync with react-reconciler/getComponentNameFromFiber
function getWrappedName(
  outerType: mixed,
  innerType: any,
  wrapperName: string,
): string {
  const displayName = (outerType: any).displayName;
  if (displayName) {
    return displayName;
  }
  const functionName = innerType.displayName || innerType.name || '';
  return functionName !== '' ? `${wrapperName}(${functionName})` : wrapperName;
}

// Keep in sync with react-reconciler/getComponentNameFromFiber
function getContextName(type: ReactContext<any>) {
  return type.displayName || 'Context';
}

const REACT_CLIENT_REFERENCE = Symbol.for('react.client.reference');

// Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
export default function getComponentNameFromType(type: mixed): string | null {
  if (type == null) {
    // Host root, text node or just invalid type.
    return null;
// ... (75 more lines)

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does getComponentNameFromType.js do?
getComponentNameFromType.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 getComponentNameFromType.js?
getComponentNameFromType.js defines 3 function(s): getComponentNameFromType, getContextName, getWrappedName.
What does getComponentNameFromType.js depend on?
getComponentNameFromType.js imports 4 module(s): ReactFeatureFlags.js, ReactLazy, ReactSymbols, ReactTypes.
What files import getComponentNameFromType.js?
getComponentNameFromType.js is imported by 1 file(s): ReactPerformanceTrackProperties.js.
Where is getComponentNameFromType.js in the architecture?
getComponentNameFromType.js is located at packages/shared/getComponentNameFromType.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