Skip to content
FrameworkStyle

useErrorDialogContext

Hook to access the nearest ErrorDialog compound-component context

Import

import { useErrorDialogContext } from "@videojs/react";

Usage

Use this hook to build a custom part rendered inside ErrorDialog.Root.

function ErrorCode() {
  const { lastError } = useErrorDialogContext();

  return lastError ? <code>{lastError.code}</code> : null;
}

The hook throws when there is no surrounding ErrorDialog.Root.

API Reference

Return Value

PropertyTypeDetails
lastErrorErrorLike | null