Home / Function/ reactPaths() — react Function Reference

reactPaths() — react Function Reference

Architecture documentation for the reactPaths() function in react-loader.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  1e03480c_7f31_6e6a_5dc9_22841e2105d8["reactPaths()"]
  dd026ac1_6193_60a0_f5c1_cc7da4d3c4af["react-loader.js"]
  1e03480c_7f31_6e6a_5dc9_22841e2105d8 -->|defined in| dd026ac1_6193_60a0_f5c1_cc7da4d3c4af
  fab813e3_12c8_f97c_4ba0_4d6f53b355b8["render()"]
  fab813e3_12c8_f97c_4ba0_4d6f53b355b8 -->|calls| 1e03480c_7f31_6e6a_5dc9_22841e2105d8
  6a16ba39_67e4_1613_55b4_346b67d822dd["findDOMNode()"]
  6a16ba39_67e4_1613_55b4_346b67d822dd -->|calls| 1e03480c_7f31_6e6a_5dc9_22841e2105d8
  83707f54_2192_80b8_bcfe_57a894138f14["loadReact()"]
  83707f54_2192_80b8_bcfe_57a894138f14 -->|calls| 1e03480c_7f31_6e6a_5dc9_22841e2105d8
  8dabe94e_7672_edf4_2a24_5e3521953db8["getVersion()"]
  1e03480c_7f31_6e6a_5dc9_22841e2105d8 -->|calls| 8dabe94e_7672_edf4_2a24_5e3521953db8
  90c13ca0_78d7_610e_36e6_cbb10916ebcb["parseQuery()"]
  1e03480c_7f31_6e6a_5dc9_22841e2105d8 -->|calls| 90c13ca0_78d7_610e_36e6_cbb10916ebcb
  style 1e03480c_7f31_6e6a_5dc9_22841e2105d8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

fixtures/dom/src/react-loader.js lines 75–151

export function reactPaths(version = getVersion()) {
  let query = parseQuery(window.location.search);
  let isProduction = query.production === 'true';
  let environment = isProduction ? 'production.min' : 'development';
  let reactPath = `react.${environment}.js`;
  let reactDOMPath = `react-dom.${environment}.js`;
  let reactDOMClientPath = `react-dom.${environment}.js`;
  let reactDOMServerPath = `react-dom-server.browser.${environment}.js`;
  let needsCreateElement = true;
  let needsReactDOM = true;
  let usingModules = false;

  if (version !== 'local') {
    const {major, minor, prerelease} = semver(version);
    console.log('semver', semver(version));

    if (major === 0) {
      needsCreateElement = minor >= 12;
      needsReactDOM = minor >= 14;
    }

    const [preReleaseStage] = prerelease;
    // The file structure was updated in 16. This wasn't the case for alphas.
    // Load the old module location for anything less than 16 RC
    if (major >= 19) {
      usingModules = true;
      const devQuery = environment === 'development' ? '?dev' : '';
      reactPath = 'https://esm.sh/react@' + version + '/' + devQuery;
      reactDOMPath = 'https://esm.sh/react-dom@' + version + '/' + devQuery;
      reactDOMClientPath =
        'https://esm.sh/react-dom@' + version + '/client' + devQuery;
      reactDOMServerPath =
        'https://esm.sh/react-dom@' + version + '/server.browser' + devQuery;
    } else if (major >= 16 && !(minor === 0 && preReleaseStage === 'alpha')) {
      reactPath =
        'https://unpkg.com/react@' +
        version +
        '/umd/react.' +
        environment +
        '.js';
      reactDOMPath =
        'https://unpkg.com/react-dom@' +
        version +
        '/umd/react-dom.' +
        environment +
        '.js';
      reactDOMServerPath =
        'https://unpkg.com/react-dom@' +
        version +
        '/umd/react-dom-server.browser' +
        environment;
    } else if (major > 0 || minor > 11) {
      reactPath = 'https://unpkg.com/react@' + version + '/dist/react.js';
      reactDOMPath =
        'https://unpkg.com/react-dom@' + version + '/dist/react-dom.js';
      reactDOMServerPath =
        'https://unpkg.com/react-dom@' + version + '/dist/react-dom-server.js';
    } else {
      reactPath =
        'https://cdnjs.cloudflare.com/ajax/libs/react/' + version + '/react.js';
    }
  } else {
    throw new Error(
      'This fixture no longer works with local versions. Provide a version query parameter that matches a version published to npm to use the fixture.'
    );
  }

  return {
    reactPath,
    reactDOMPath,
    reactDOMClientPath,
    reactDOMServerPath,
    needsCreateElement,
    needsReactDOM,
    usingModules,
  };
}

Domain

Subdomains

Frequently Asked Questions

What does reactPaths() do?
reactPaths() is a function in the react codebase, defined in fixtures/dom/src/react-loader.js.
Where is reactPaths() defined?
reactPaths() is defined in fixtures/dom/src/react-loader.js at line 75.
What does reactPaths() call?
reactPaths() calls 2 function(s): getVersion, parseQuery.
What calls reactPaths()?
reactPaths() is called by 3 function(s): findDOMNode, loadReact, render.

Analyze Your Own Codebase

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

Try Supermodel Free