Home / File/ createLegacyRoot.js — react Source File

createLegacyRoot.js — react Source File

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

File javascript BabelCompiler Entrypoint 5 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  0b01b517_4763_de1a_12e5_d748facb25a6["createLegacyRoot.js"]
  bfdecbd0_e0a7_079b_e1a6_8c19bbba4ba4["./shared/ThemeContext"]
  0b01b517_4763_de1a_12e5_d748facb25a6 --> bfdecbd0_e0a7_079b_e1a6_8c19bbba4ba4
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  0b01b517_4763_de1a_12e5_d748facb25a6 --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  4d0c4ccc_5970_e7f9_458f_15f0290099b1["react-dom"]
  0b01b517_4763_de1a_12e5_d748facb25a6 --> 4d0c4ccc_5970_e7f9_458f_15f0290099b1
  68ebf7af_04e4_49eb_c396_471f6297c18c["react-router"]
  0b01b517_4763_de1a_12e5_d748facb25a6 --> 68ebf7af_04e4_49eb_c396_471f6297c18c
  56a19847_52ab_03d1_31e4_30711218e0ad["react-redux"]
  0b01b517_4763_de1a_12e5_d748facb25a6 --> 56a19847_52ab_03d1_31e4_30711218e0ad
  style 0b01b517_4763_de1a_12e5_d748facb25a6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/* eslint-disable react/jsx-pascal-case */

import React from 'react';
import ReactDOM from 'react-dom';
import ThemeContext from './shared/ThemeContext';

// Note: this is a semi-private API, but it's ok to use it
// if we never inspect the values, and only pass them through.
import {__RouterContext} from 'react-router';
import {Provider} from 'react-redux';

// Pass through every context required by this tree.
// The context object is populated in src/modern/withLegacyRoot.
function Bridge({children, context}) {
  return (
    <ThemeContext.Provider value={context.theme}>
      <__RouterContext.Provider value={context.router}>
        {/*
          If we used the newer react-redux@7.x in the legacy/package.json,
          we woud instead import {ReactReduxContext} from 'react-redux'
          and render <ReactReduxContext.Provider value={context.reactRedux}>.
        */}
        <Provider store={context.reactRedux.store}>{children}</Provider>
      </__RouterContext.Provider>
    </ThemeContext.Provider>
  );
}

export default function createLegacyRoot(container) {
  return {
    render(Component, props, context) {
      ReactDOM.render(
        <Bridge context={context}>
          <Component {...props} />
        </Bridge>,
        container
      );
    },
    unmount() {
      ReactDOM.unmountComponentAtNode(container);
    },
  };
}

Domain

Subdomains

Dependencies

  • ./shared/ThemeContext
  • react
  • react-dom
  • react-redux
  • react-router

Frequently Asked Questions

What does createLegacyRoot.js do?
createLegacyRoot.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 createLegacyRoot.js?
createLegacyRoot.js defines 2 function(s): Bridge, createLegacyRoot.
What does createLegacyRoot.js depend on?
createLegacyRoot.js imports 5 module(s): ./shared/ThemeContext, react, react-dom, react-redux, react-router.
Where is createLegacyRoot.js in the architecture?
createLegacyRoot.js is located at fixtures/nesting/src/legacy/createLegacyRoot.js (domain: BabelCompiler, subdomain: Entrypoint, directory: fixtures/nesting/src/legacy).

Analyze Your Own Codebase

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

Try Supermodel Free