import { Component } from "react"
import type { ReactNode, ErrorInfo } from "react"
interface ErrorBoundaryState {
hasError: boolean
error: Error | null
}
interface ErrorBoundaryProps {
children: ReactNode
/** Optional custom fallback UI. Receives the caught error. */
fallback?: (error: Error) => ReactNode
}
/**
* Catches render errors in the subtree and shows a fallback UI.
*
* React error boundaries must be class components — getDerivedStateFromError
* and componentDidCatch have no hook equivalents.
*
* Place this in App.tsx around your tab layout, or wrap individual tabs for
* finer-grained recovery.
*
* @example
*