Home / File/ ReactPortal.js — react Source File

ReactPortal.js — react Source File

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

File javascript BabelCompiler Validation 3 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  bcda653c_3560_f9a9_6aee_b0a921e0d32a["ReactPortal.js"]
  e1e1de60_2be4_0643_45fb_e2c306735427["ReactSymbols"]
  bcda653c_3560_f9a9_6aee_b0a921e0d32a --> e1e1de60_2be4_0643_45fb_e2c306735427
  0ae63ebd_b26a_05c8_1c6d_275a5f6b76c7["CheckStringCoercion"]
  bcda653c_3560_f9a9_6aee_b0a921e0d32a --> 0ae63ebd_b26a_05c8_1c6d_275a5f6b76c7
  d8f20c67_f5fa_0f0a_c967_c41fd9ffce07["ReactTypes"]
  bcda653c_3560_f9a9_6aee_b0a921e0d32a --> d8f20c67_f5fa_0f0a_c967_c41fd9ffce07
  style bcda653c_3560_f9a9_6aee_b0a921e0d32a 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 {REACT_PORTAL_TYPE, REACT_OPTIMISTIC_KEY} from 'shared/ReactSymbols';
import {checkKeyStringCoercion} from 'shared/CheckStringCoercion';

import type {
  ReactNodeList,
  ReactPortal,
  ReactOptimisticKey,
} from 'shared/ReactTypes';

export function createPortal(
  children: ReactNodeList,
  containerInfo: any,
  // TODO: figure out the API for cross-renderer implementation.
  implementation: any,
  key: ?string | ReactOptimisticKey = null,
): ReactPortal {
  let resolvedKey;
  if (key == null) {
    resolvedKey = null;
  } else if (key === REACT_OPTIMISTIC_KEY) {
    resolvedKey = REACT_OPTIMISTIC_KEY;
  } else {
    if (__DEV__) {
      checkKeyStringCoercion(key);
    }
    resolvedKey = '' + key;
  }
  return {
    // This tag allow us to uniquely identify this as a React Portal
    $$typeof: REACT_PORTAL_TYPE,
    key: resolvedKey,
    children,
    containerInfo,
    implementation,
  };
}

Domain

Subdomains

Functions

Dependencies

  • CheckStringCoercion
  • ReactSymbols
  • ReactTypes

Frequently Asked Questions

What does ReactPortal.js do?
ReactPortal.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in ReactPortal.js?
ReactPortal.js defines 1 function(s): createPortal.
What does ReactPortal.js depend on?
ReactPortal.js imports 3 module(s): CheckStringCoercion, ReactSymbols, ReactTypes.
Where is ReactPortal.js in the architecture?
ReactPortal.js is located at packages/react-reconciler/src/ReactPortal.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-reconciler/src).

Analyze Your Own Codebase

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

Try Supermodel Free