Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Component<ErrorBoundaryProps, ErrorBoundaryState>
    • ErrorBoundary

Index

Constructors

  • new ErrorBoundary(props: Readonly<ErrorBoundaryProps>): ErrorBoundary

Properties

errorTitle: undefined | string
props: Readonly<ErrorBoundaryProps> & Readonly<{ children?: ReactNode }>
refs: {}

Type declaration

  • [key: string]: ReactInstance
state: Readonly<ErrorBoundaryState>
contextType: Context<LoggingHandler> = loggerContext

Methods

  • UNSAFE_componentWillMount(): void
  • UNSAFE_componentWillReceiveProps(nextProps: Readonly<ErrorBoundaryProps>, nextContext: any): void
  • UNSAFE_componentWillUpdate(nextProps: Readonly<ErrorBoundaryProps>, nextState: Readonly<ErrorBoundaryState>, nextContext: any): void
  • componentDidCatch(error: Error, errorInfo: ErrorInfo): void
  • componentDidMount(): void
  • Called immediately after a component is mounted. Setting state here will trigger re-rendering.

    Returns void

  • componentDidUpdate(prevProps: Readonly<ErrorBoundaryProps>, prevState: Readonly<ErrorBoundaryState>, snapshot?: any): void
  • Called immediately after updating occurs. Not called for the initial render.

    The snapshot is only present if getSnapshotBeforeUpdate is present and returns non-null.

    Parameters

    • prevProps: Readonly<ErrorBoundaryProps>
    • prevState: Readonly<ErrorBoundaryState>
    • Optional snapshot: any

    Returns void

  • componentWillMount(): void
  • componentWillReceiveProps(nextProps: Readonly<ErrorBoundaryProps>, nextContext: any): void
  • componentWillUnmount(): void
  • Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as cancelled network requests, or cleaning up any DOM elements created in componentDidMount.

    Returns void

  • componentWillUpdate(nextProps: Readonly<ErrorBoundaryProps>, nextState: Readonly<ErrorBoundaryState>, nextContext: any): void
  • forceUpdate(callback?: (() => void)): void
  • Parameters

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

    Returns void

  • getSnapshotBeforeUpdate(prevProps: Readonly<ErrorBoundaryProps>, prevState: Readonly<ErrorBoundaryState>): any
  • Runs before React applies the result of render to the document, and returns an object to be given to componentDidUpdate. Useful for saving things such as scroll position before render causes changes to it.

    Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated lifecycle events from running.

    Parameters

    • prevProps: Readonly<ErrorBoundaryProps>
    • prevState: Readonly<ErrorBoundaryState>

    Returns any

  • render(): ReactNode
  • setState<K>(state: null | ErrorBoundaryState | ((prevState: Readonly<ErrorBoundaryState>, props: Readonly<ErrorBoundaryProps>) => null | ErrorBoundaryState | Pick<ErrorBoundaryState, K>) | Pick<ErrorBoundaryState, K>, callback?: (() => void)): void
  • Type Parameters

    • K extends keyof ErrorBoundaryState

    Parameters

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

    Returns void

  • shouldComponentUpdate(nextProps: Readonly<ErrorBoundaryProps>, nextState: Readonly<ErrorBoundaryState>, nextContext: any): boolean
  • Called to determine whether the change in props and state should trigger a re-render.

    Component always returns true. PureComponent implements a shallow comparison on props and state and returns true if any props or states have changed.

    If false is returned, Component#render, componentWillUpdate and componentDidUpdate will not be called.

    Parameters

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

    Returns boolean

Generated using TypeDoc