ErrorBoundary

ErrorBoundary component

A generic error boundary that catches errors during rendering of its child components. When an error occurs, it uses the provided ErrorHandler to log the error and renders a fallback UI.

Constructor

new ErrorBoundary(props) → {JSX.Element}

Parameters:
NameTypeDescription
propsObject

Component props.

Properties
NameTypeAttributesDescription
fallbackReact.ComponentType<optional>

Optional fallback component to render if an error occurs. Defaults to Spinner.

Returns:

The children wrapped by the error boundary or the fallback UI.

Type: 
JSX.Element
Example
// Wrap any component tree with ErrorBoundary
<ErrorBoundary fallback={<CustomFallback />}>
  <MyComponent />
</ErrorBoundary>

ErrorBoundary

ErrorBoundary component

A generic error boundary that catches errors during rendering of its child components. When an error occurs, it uses the provided ErrorHandler to log the error and renders a fallback UI.

Constructor

new ErrorBoundary(props) → {JSX.Element}

Parameters:
NameTypeDescription
propsObject

Component props.

Properties
NameTypeAttributesDescription
fallbackReact.ComponentType<optional>

Optional fallback component to render if an error occurs. Defaults to Spinner.

Returns:

The children wrapped by the error boundary or the fallback UI.

Type: 
JSX.Element
Example
// Wrap any component tree with ErrorBoundary
<ErrorBoundary fallback={<CustomFallback />}>
  <MyComponent />
</ErrorBoundary>