ErrorBoundary is a higher-order component that captures JavaScript errors anywhere in their child component tree, logs those errors, and displays a fallback UI.

This component is useful for ensuring that the entire application does not crash due to unhandled errors.

Hierarchy

  • Component<Props, State>
    • default

Constructors

Methods

Constructors

  • Creates a new instance of the ErrorBoundary component.

    Parameters

    • props: Props

      Props passed to the component.

    Returns default

Methods

  • Catches errors that occur in the child components and updates the component state.

    Parameters

    • error: Error

      The thrown error.

    • info: ErrorInfo

      Additional information about what caused the error.

    Returns void

  • Renders the fallback UI in case of an error or the child components if everything is fine.

    Returns undefined | null | string | number | boolean | Element | Iterable<ReactNode>

Generated using TypeDoc