Home / Class/ ErrorBoundary Class — react Architecture

ErrorBoundary Class — react Architecture

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

Entity Profile

Dependency Diagram

graph TD
  4f7238ce_412c_e3db_5d47_19f70622deba["ErrorBoundary"]
  6afa5079_51da_fd01_2910_72d589bc20ca["ActivityErrorHandling-test.js"]
  4f7238ce_412c_e3db_5d47_19f70622deba -->|defined in| 6afa5079_51da_fd01_2910_72d589bc20ca
  c8e17e25_47b6_fd3f_c86a_1b5a6a540402["getDerivedStateFromError()"]
  4f7238ce_412c_e3db_5d47_19f70622deba -->|method| c8e17e25_47b6_fd3f_c86a_1b5a6a540402
  30b5c9c2_61c4_5de9_0262_fc06988b9d0d["render()"]
  4f7238ce_412c_e3db_5d47_19f70622deba -->|method| 30b5c9c2_61c4_5de9_0262_fc06988b9d0d

Relationship Graph

Source Code

packages/react-reconciler/src/__tests__/ActivityErrorHandling-test.js lines 33–46

      class ErrorBoundary extends React.Component {
        state = {error: null};
        static getDerivedStateFromError(error) {
          return {error};
        }
        render() {
          if (this.state.error) {
            return (
              <Text text={`Caught an error: ${this.state.error.message}`} />
            );
          }
          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__/ActivityErrorHandling-test.js.
Where is ErrorBoundary defined?
ErrorBoundary is defined in packages/react-reconciler/src/__tests__/ActivityErrorHandling-test.js at line 33.

Analyze Your Own Codebase

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

Try Supermodel Free