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 Optimization 4 imports 4 functions 9 classes

Entity Profile

Dependency Diagram

graph LR
  81bda781_d1ab_04a2_f9a5_679111cfc7c2["index.js"]
  43315ad6_972b_89f2_a26c_ae2c6075675a["FixtureSet.js"]
  81bda781_d1ab_04a2_f9a5_679111cfc7c2 --> 43315ad6_972b_89f2_a26c_ae2c6075675a
  f3e4d030_5f7e_b1af_0ae5_fcdf80961e8c["FixtureSet"]
  81bda781_d1ab_04a2_f9a5_679111cfc7c2 --> f3e4d030_5f7e_b1af_0ae5_fcdf80961e8c
  14dde3c9_48ef_6e34_3667_978d06aff15d["TestCase.js"]
  81bda781_d1ab_04a2_f9a5_679111cfc7c2 --> 14dde3c9_48ef_6e34_3667_978d06aff15d
  e1e356f5_b085_dad5_a81f_4b4844381311["TestCase"]
  81bda781_d1ab_04a2_f9a5_679111cfc7c2 --> e1e356f5_b085_dad5_a81f_4b4844381311
  style 81bda781_d1ab_04a2_f9a5_679111cfc7c2 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;

function BadRender(props) {
  props.doThrow();
}

class BadDidMount extends React.Component {
  componentDidMount() {
    this.props.doThrow();
  }

  render() {
    return null;
  }
}

class ErrorBoundary extends React.Component {
  static defaultProps = {
    buttonText: 'Trigger error',
    badChildType: BadRender,
  };
  state = {
    shouldThrow: false,
    didThrow: false,
    error: null,
  };
  componentDidCatch(error) {
    this.setState({error, didThrow: true});
  }
  triggerError = () => {
    this.setState({
      shouldThrow: true,
    });
  };
  render() {
    if (this.state.didThrow) {
      if (this.state.error) {
        return <p>Captured an error: {this.state.error.message}</p>;
      } else {
        return <p>Captured an error: {String(this.state.error)}</p>;
      }
    }
    if (this.state.shouldThrow) {
      const BadChild = this.props.badChildType;
      return <BadChild doThrow={this.props.doThrow} />;
    }
    return <button onClick={this.triggerError}>{this.props.buttonText}</button>;
  }
}
class Example extends React.Component {
  state = {key: 0};
  restart = () => {
    this.setState(state => ({key: state.key + 1}));
  };
  render() {
    return (
// ... (347 more lines)

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, Optimization subdomain.
What functions are defined in index.js?
index.js defines 4 function(s): BadRender, memoizedFunction, naiveMemoize, silenceWindowError.
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/error-handling/index.js (domain: BabelCompiler, subdomain: Optimization, directory: fixtures/dom/src/components/fixtures/error-handling).

Analyze Your Own Codebase

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

Try Supermodel Free