Class ErrorBoundary

Класс-ловушка для обработки ошибок компонентов

Example

<ErrorBoundary>
<ComponentWithError />
</ErrorBoundary>

Hierarchy

  • Component<ErrorBoundaryProps, ErrorBoundaryState>
    • ErrorBoundary

Constructors

  • Parameters

    • Optional props: ErrorBoundaryProps
    • Optional context: any

    Returns ErrorBoundary

Properties

displayName?: string
defaultProps?: any
contextType?: Context<any>
state: Readonly<ErrorBoundaryState>
props: RenderableProps<ErrorBoundaryProps, any>
context: any
base?: Element | Text

Methods

  • Returns void

  • Returns void

  • Returns void

  • Returns object

  • Parameters

    • nextProps: Readonly<ErrorBoundaryProps>
    • nextContext: any

    Returns void

  • Parameters

    • nextProps: Readonly<ErrorBoundaryProps>
    • nextState: Readonly<ErrorBoundaryState>
    • nextContext: any

    Returns boolean

  • Parameters

    • nextProps: Readonly<ErrorBoundaryProps>
    • nextState: Readonly<ErrorBoundaryState>
    • nextContext: any

    Returns void

  • Parameters

    • oldProps: Readonly<ErrorBoundaryProps>
    • oldState: Readonly<ErrorBoundaryState>

    Returns any

  • Parameters

    • previousProps: Readonly<ErrorBoundaryProps>
    • previousState: Readonly<ErrorBoundaryState>
    • snapshot: any

    Returns void

  • Parameters

    • props: object
    • state: object

    Returns null | object

  • Type Parameters

    • K extends "error"

    Parameters

    • state: null | Partial<ErrorBoundaryState> | ((prevState, props) => null | Partial<ErrorBoundaryState> | Pick<ErrorBoundaryState, K>) | Pick<ErrorBoundaryState, K>
    • Optional callback: (() => void)
        • (): void
        • Returns void

    Returns void

  • Parameters

    • Optional callback: (() => void)
        • (): void
        • Returns void

    Returns void

  • Private

    Parameters

    • error: Error

    Returns {
        error: Error;
    }

    • error: Error
  • Private

    Parameters

    • error: Error

    Returns void

Generated using TypeDoc