Home / File/ ReactDOM.js — react Source File

ReactDOM.js — react Source File

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

File javascript BabelCompiler Validation 13 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  ca23127c_62b0_2c69_7293_39d92b24a5c0["ReactDOM.js"]
  7c97d39b_70ad_d3ea_12fc_3413f53dc064["ReactDOMFlushSync.js"]
  ca23127c_62b0_2c69_7293_39d92b24a5c0 --> 7c97d39b_70ad_d3ea_12fc_3413f53dc064
  3ea12e77_bd9c_ec2a_fb3c_db692f520137["ReactDOMFloat.js"]
  ca23127c_62b0_2c69_7293_39d92b24a5c0 --> 3ea12e77_bd9c_ec2a_fb3c_db692f520137
  93a06b1f_f85f_8382_cf82_eb484cb62c48["prefetchDNS"]
  ca23127c_62b0_2c69_7293_39d92b24a5c0 --> 93a06b1f_f85f_8382_cf82_eb484cb62c48
  8bd7770b_5077_a45f_999e_1a8841298249["preconnect"]
  ca23127c_62b0_2c69_7293_39d92b24a5c0 --> 8bd7770b_5077_a45f_999e_1a8841298249
  ef6689b7_855b_a56d_c03a_a1f2644487cd["preload"]
  ca23127c_62b0_2c69_7293_39d92b24a5c0 --> ef6689b7_855b_a56d_c03a_a1f2644487cd
  a5580aac_8777_020f_2182_f5394bec2548["preloadModule"]
  ca23127c_62b0_2c69_7293_39d92b24a5c0 --> a5580aac_8777_020f_2182_f5394bec2548
  6d07b3fb_e69b_4921_1d4d_786c313f16d3["preinit"]
  ca23127c_62b0_2c69_7293_39d92b24a5c0 --> 6d07b3fb_e69b_4921_1d4d_786c313f16d3
  76790122_fb77_9e84_74d3_ed16373affff["preinitModule"]
  ca23127c_62b0_2c69_7293_39d92b24a5c0 --> 76790122_fb77_9e84_74d3_ed16373affff
  d8f20c67_f5fa_0f0a_c967_c41fd9ffce07["ReactTypes"]
  ca23127c_62b0_2c69_7293_39d92b24a5c0 --> d8f20c67_f5fa_0f0a_c967_c41fd9ffce07
  0b5d77d6_fa00_515b_1198_0f2d2642dc21["ReactVersion"]
  ca23127c_62b0_2c69_7293_39d92b24a5c0 --> 0b5d77d6_fa00_515b_1198_0f2d2642dc21
  a3cf5227_1f98_134e_5b97_2f5a7eb1ceee["ReactDOMContainer"]
  ca23127c_62b0_2c69_7293_39d92b24a5c0 --> a3cf5227_1f98_134e_5b97_2f5a7eb1ceee
  182df6ee_8a66_3ae5_5e15_66ae1688a2c6["ReactPortal"]
  ca23127c_62b0_2c69_7293_39d92b24a5c0 --> 182df6ee_8a66_3ae5_5e15_66ae1688a2c6
  62e2fec2_e711_12c4_7d64_849f40199109["ReactDOMFormActions"]
  ca23127c_62b0_2c69_7293_39d92b24a5c0 --> 62e2fec2_e711_12c4_7d64_849f40199109
  style ca23127c_62b0_2c69_7293_39d92b24a5c0 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 {ReactNodeList} from 'shared/ReactTypes';

import ReactVersion from 'shared/ReactVersion';

import {isValidContainer} from 'react-dom-bindings/src/client/ReactDOMContainer';
import {createPortal as createPortalImpl} from 'react-reconciler/src/ReactPortal';
import {flushSync} from './ReactDOMFlushSync';

import {
  prefetchDNS,
  preconnect,
  preload,
  preloadModule,
  preinit,
  preinitModule,
} from './ReactDOMFloat';
import {
  requestFormReset,
  useFormStatus,
  useFormState,
} from 'react-dom-bindings/src/shared/ReactDOMFormActions';

if (__DEV__) {
  if (
    typeof Map !== 'function' ||
    // $FlowFixMe[prop-missing] Flow incorrectly thinks Map has no prototype
    Map.prototype == null ||
    typeof Map.prototype.forEach !== 'function' ||
    typeof Set !== 'function' ||
    // $FlowFixMe[prop-missing] Flow incorrectly thinks Set has no prototype
    Set.prototype == null ||
    typeof Set.prototype.clear !== 'function' ||
    typeof Set.prototype.forEach !== 'function'
  ) {
    console.error(
      'React depends on Map and Set built-in types. Make sure that you load a ' +
        'polyfill in older browsers. https://reactjs.org/link/react-polyfills',
    );
  }
}

function batchedUpdates<A, R>(fn: (a: A) => R, a: A): R {
  // batchedUpdates is now just a passthrough noop
  return fn(a);
}

function createPortal(
  children: ReactNodeList,
  container: Element | DocumentFragment,
  key: ?string = null,
): React$Portal {
  if (!isValidContainer(container)) {
    throw new Error('Target container is not a DOM element.');
  }

  // TODO: pass ReactDOM portal implementation as third argument
  // $FlowFixMe[incompatible-return] The Flow type is opaque but there's no way to actually create it.
  return createPortalImpl(children, container, null, key);
}

export {
  ReactVersion as version,
  createPortal,
  flushSync,
  batchedUpdates as unstable_batchedUpdates,
  prefetchDNS,
  preconnect,
  preload,
  preloadModule,
  preinit,
  preinitModule,
  requestFormReset,
  useFormStatus,
  useFormState,
};

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does ReactDOM.js do?
ReactDOM.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 ReactDOM.js?
ReactDOM.js defines 2 function(s): batchedUpdates, createPortal.
What does ReactDOM.js depend on?
ReactDOM.js imports 13 module(s): ReactDOMContainer, ReactDOMFloat.js, ReactDOMFlushSync.js, ReactDOMFormActions, ReactPortal, ReactTypes, ReactVersion, preconnect, and 5 more.
Where is ReactDOM.js in the architecture?
ReactDOM.js is located at packages/react-dom/src/shared/ReactDOM.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-dom/src/shared).

Analyze Your Own Codebase

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

Try Supermodel Free