Represents an error boundary component in React.

Hierarchy (View Summary)

  • dayjs<IErrorBoundaryProps, IErrorBoundaryState>
    • ErrorBoundary

Constructors

  • Parameters

    • props: IErrorBoundaryProps

    Returns ErrorBoundary

Properties

componentDidCatch: (error: any, errorInfo: any) => void

Handles error caught during rendering in React components.

Type declaration

    • (error: any, errorInfo: any): void
    • Parameters

      • error: any

        The error object that was caught.

      • errorInfo: any

        Additional information about the error.

      Returns void

[ComponentName]

componentDidMount: () => void

Listen for error cancelation

Type declaration

    • (): void
    • Returns void

componentDidMount

Component

componentDidUpdate: () => void

Listens for updates to the component and handles error state.

Type declaration

    • (): void
    • Returns void

componentDidUpdate

Component

componentWillUnmount: () => void

Clears the garbage

Type declaration

    • (): void
    • Returns void

componentWillUnmount

Component

render: () => ReactNode

A function that renders the children component. If there is an error in the state, it will return null. Otherwise, it will return the children component.

Type declaration

    • (): ReactNode
    • Returns ReactNode

      The rendered component or null if there is an error in the state.

Methods

  • Returns an object that represents the new state for a component when an error is thrown during rendering. This is a static method that can be implemented in a React class component.

    Returns { hasError: boolean }

    The new state object with the 'hasError' property set to true.