import { Component, type ErrorInfo, type ReactNode } from 'react'; interface Props { children: ReactNode; } interface State { hasError: boolean; } export class ErrorBoundary extends Component { constructor(props: Props) { super(props); this.state = { hasError: false }; } static getDerivedStateFromError(): State { return { hasError: true }; } componentDidCatch(error: Error, info: ErrorInfo) { console.error('ErrorBoundary caught an error:', error, info); } render() { if (this.state.hasError) { return (

Something went wrong

An unexpected error occurred. Please try reloading the page.

); } return this.props.children; } }