Home / File/ index.js — react Source File

index.js — react Source File

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

Entity Profile

Dependency Diagram

graph LR
  9f1d73bc_10b4_6f20_3101_55819618d137["index.js"]
  b13e4ec8_edeb_b96a_c7f8_f960677a6e23["polyfills.js"]
  9f1d73bc_10b4_6f20_3101_55819618d137 --> b13e4ec8_edeb_b96a_c7f8_f960677a6e23
  dd026ac1_6193_60a0_f5c1_cc7da4d3c4af["react-loader.js"]
  9f1d73bc_10b4_6f20_3101_55819618d137 --> dd026ac1_6193_60a0_f5c1_cc7da4d3c4af
  style 9f1d73bc_10b4_6f20_3101_55819618d137 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import './polyfills';
import loadReact, {isLocal} from './react-loader';

if (isLocal()) {
  Promise.all([
    import('react'),
    import('react-dom'),
    import('react-dom/client'),
  ])
    .then(([React, ReactDOM, ReactDOMClient]) => {
      if (
        React === undefined ||
        ReactDOM === undefined ||
        ReactDOMClient === undefined
      ) {
        throw new Error(
          'Unable to load React. Build experimental and then run `yarn dev` again'
        );
      }
      window.React = React;
      window.ReactDOM = ReactDOM;
      window.ReactDOMClient = ReactDOMClient;
    })
    .then(() => import('./components/App'))
    .then(App => {
      window.ReactDOMClient.createRoot(document.getElementById('root')).render(
        window.React.createElement(App.default)
      );
    });
} else {
  loadReact()
    .then(() => import('./components/App'))
    .then(App => {
      const {React, ReactDOM} = window;
      if (
        typeof window.ReactDOMClient !== 'undefined' &&
        typeof window.ReactDOMClient.createRoot !== 'undefined'
      ) {
        // we are in a React that only supports modern roots

        window.ReactDOMClient.createRoot(
          document.getElementById('root')
        ).render(React.createElement(App.default));
      } else {
        ReactDOM.render(
          React.createElement(App.default),
          document.getElementById('root')
        );
      }
    });
}

Domain

Frequently Asked Questions

What does index.js do?
index.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain.
What does index.js depend on?
index.js imports 2 module(s): polyfills.js, react-loader.js.
Where is index.js in the architecture?
index.js is located at fixtures/dom/src/index.js (domain: BabelCompiler, directory: fixtures/dom/src).

Analyze Your Own Codebase

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

Try Supermodel Free