Home / Class/ ErrorBoundary Class — react Architecture

ErrorBoundary Class — react Architecture

Architecture documentation for the ErrorBoundary class in ReactIncrementalErrorHandling-test.internal.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  85aa5e94_db42_320f_c0e2_bd73b3bee449["ErrorBoundary"]
  bdc0ced0_3b40_1f5c_3bb2_d99e616f9728["ReactIncrementalErrorHandling-test.internal.js"]
  85aa5e94_db42_320f_c0e2_bd73b3bee449 -->|defined in| bdc0ced0_3b40_1f5c_3bb2_d99e616f9728
  fafe4eaa_c3f0_bebf_b251_a0422c7fd1aa["getDerivedStateFromError()"]
  85aa5e94_db42_320f_c0e2_bd73b3bee449 -->|method| fafe4eaa_c3f0_bebf_b251_a0422c7fd1aa
  6be7c85c_9f96_874a_2ae3_4270f0aca920["render()"]
  85aa5e94_db42_320f_c0e2_bd73b3bee449 -->|method| 6be7c85c_9f96_874a_2ae3_4270f0aca920
  85970691_9473_44d3_903d_76eb3935a256["componentDidCatch()"]
  85aa5e94_db42_320f_c0e2_bd73b3bee449 -->|method| 85970691_9473_44d3_903d_76eb3935a256

Relationship Graph

Source Code

packages/react-reconciler/src/__tests__/ReactIncrementalErrorHandling-test.internal.js lines 69–83

    class ErrorBoundary extends React.Component {
      state = {error: null};
      static getDerivedStateFromError(error) {
        Scheduler.log('getDerivedStateFromError');
        return {error};
      }
      render() {
        if (this.state.error) {
          Scheduler.log('ErrorBoundary (catch)');
          return <ErrorMessage error={this.state.error} />;
        }
        Scheduler.log('ErrorBoundary (try)');
        return this.props.children;
      }
    }

Frequently Asked Questions

What is the ErrorBoundary class?
ErrorBoundary is a class in the react codebase, defined in packages/react-reconciler/src/__tests__/ReactIncrementalErrorHandling-test.internal.js.
Where is ErrorBoundary defined?
ErrorBoundary is defined in packages/react-reconciler/src/__tests__/ReactIncrementalErrorHandling-test.internal.js at line 69.

Analyze Your Own Codebase

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

Try Supermodel Free