Home / Class/ ErrorBoundary Class — react Architecture

ErrorBoundary Class — react Architecture

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

Entity Profile

Dependency Diagram

graph TD
  59179783_c730_9837_300b_803c1436b3bc["ErrorBoundary"]
  fe211a86_e2e1_3288_1961_063bfe81195e["ReactHooksWithNoopRenderer-test.js"]
  59179783_c730_9837_300b_803c1436b3bc -->|defined in| fe211a86_e2e1_3288_1961_063bfe81195e
  c9ffc3a8_6096_c76f_9307_493b84fc71c4["getDerivedStateFromError()"]
  59179783_c730_9837_300b_803c1436b3bc -->|method| c9ffc3a8_6096_c76f_9307_493b84fc71c4
  c7524ce4_6a55_47b9_6365_86b34feecee8["render()"]
  59179783_c730_9837_300b_803c1436b3bc -->|method| c7524ce4_6a55_47b9_6365_86b34feecee8

Relationship Graph

Source Code

packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js lines 3173–3189

      class ErrorBoundary extends React.Component {
        state = {error: null};
        static getDerivedStateFromError(error) {
          Scheduler.log(`ErrorBoundary static getDerivedStateFromError`);
          return {error};
        }
        render() {
          const {children, id, fallbackID} = this.props;
          const {error} = this.state;
          if (error) {
            Scheduler.log(`${id} render error`);
            return <Component id={fallbackID} />;
          }
          Scheduler.log(`${id} render success`);
          return children || null;
        }
      }

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free