Home / File/ index.js — react Source File

index.js — react Source File

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

File javascript BabelCompiler Entrypoint 4 imports 2 classes

Entity Profile

Dependency Diagram

graph LR
  1268e058_b423_142a_d0e4_269d0187acb2["index.js"]
  43315ad6_972b_89f2_a26c_ae2c6075675a["FixtureSet.js"]
  1268e058_b423_142a_d0e4_269d0187acb2 --> 43315ad6_972b_89f2_a26c_ae2c6075675a
  f3e4d030_5f7e_b1af_0ae5_fcdf80961e8c["FixtureSet"]
  1268e058_b423_142a_d0e4_269d0187acb2 --> f3e4d030_5f7e_b1af_0ae5_fcdf80961e8c
  14dde3c9_48ef_6e34_3667_978d06aff15d["TestCase.js"]
  1268e058_b423_142a_d0e4_269d0187acb2 --> 14dde3c9_48ef_6e34_3667_978d06aff15d
  e1e356f5_b085_dad5_a81f_4b4844381311["TestCase"]
  1268e058_b423_142a_d0e4_269d0187acb2 --> e1e356f5_b085_dad5_a81f_4b4844381311
  style 1268e058_b423_142a_d0e4_269d0187acb2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import FixtureSet from '../../FixtureSet';
import TestCase from '../../TestCase';

const React = window.React;
const ReactDOM = window.ReactDOM;

const supportsCustomElements = typeof customElements !== 'undefined';

class HelloWorld extends React.Component {
  render() {
    return <h1>Hello, world!</h1>;
  }
}

if (supportsCustomElements) {
  // Babel breaks web components.
  // https://github.com/w3c/webcomponents/issues/587
  // eslint-disable-next-line no-new-func
  const MyElement = new Function(
    'React',
    'ReactDOM',
    'HelloWorld',
    `
    return class MyElement extends HTMLElement {
      constructor() {
        super();
        const shadowRoot = this.attachShadow({ mode:'open' });
        ReactDOM.render(React.createElement(HelloWorld), shadowRoot);
      }
    }`
  )(React, ReactDOM, HelloWorld);
  customElements.define('my-element', MyElement);
}

export default class ButtonTestCases extends React.Component {
  render() {
    return (
      <FixtureSet
        title="Custom Elements"
        description="Support for Custom Element DOM standards.">
        <TestCase title="Rendering into shadow root">
          <TestCase.ExpectedResult>
            You should see "Hello, World" printed below.{' '}
          </TestCase.ExpectedResult>
          {supportsCustomElements ? (
            <my-element />
          ) : (
            <div>This browser does not support custom elements.</div>
          )}
        </TestCase>
      </FixtureSet>
    );
  }
}

Domain

Subdomains

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, Entrypoint subdomain.
What does index.js depend on?
index.js imports 4 module(s): FixtureSet, FixtureSet.js, TestCase, TestCase.js.
Where is index.js in the architecture?
index.js is located at fixtures/dom/src/components/fixtures/custom-elements/index.js (domain: BabelCompiler, subdomain: Entrypoint, directory: fixtures/dom/src/components/fixtures/custom-elements).

Analyze Your Own Codebase

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

Try Supermodel Free