Home / Class/ ErrorBoundary Class — react Architecture

ErrorBoundary Class — react Architecture

Architecture documentation for the ErrorBoundary class in Example.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  541aad93_7758_4c5d_912b_e447031aedd1["ErrorBoundary"]
  2630ae57_7cdf_3d8c_c26e_5a67044aaba2["Example.js"]
  541aad93_7758_4c5d_912b_e447031aedd1 -->|defined in| 2630ae57_7cdf_3d8c_c26e_5a67044aaba2
  9fd54708_6c96_7a7a_461c_94f97d890961["getDerivedStateFromError()"]
  541aad93_7758_4c5d_912b_e447031aedd1 -->|method| 9fd54708_6c96_7a7a_461c_94f97d890961
  484c1710_23df_9f3c_18ce_2a2b64c7f775["componentDidCatch()"]
  541aad93_7758_4c5d_912b_e447031aedd1 -->|method| 484c1710_23df_9f3c_18ce_2a2b64c7f775
  e8704833_f8f5_5ead_912f_13d5f28b7aa6["render()"]
  541aad93_7758_4c5d_912b_e447031aedd1 -->|method| e8704833_f8f5_5ead_912f_13d5f28b7aa6

Relationship Graph

Source Code

fixtures/stacks/Example.js lines 12–37

class ErrorBoundary extends React.Component {
  static getDerivedStateFromError(error) {
    return {
      error: error,
    };
  }

  componentDidCatch(error, errorInfo) {
    console.log(error.message, errorInfo.componentStack);
    this.setState({
      componentStack: errorInfo.componentStack,
    });
  }

  render() {
    if (this.state && this.state.error) {
      return x(
        'div',
        null,
        x('h3', null, this.state.error.message),
        x('pre', null, this.state.componentStack)
      );
    }
    return this.props.children;
  }
}

Domain

Frequently Asked Questions

What is the ErrorBoundary class?
ErrorBoundary is a class in the react codebase, defined in fixtures/stacks/Example.js.
Where is ErrorBoundary defined?
ErrorBoundary is defined in fixtures/stacks/Example.js at line 12.

Analyze Your Own Codebase

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

Try Supermodel Free