import { Component, ErrorInfo, ReactNode } from 'react'; interface Props { children: ReactNode; fallback?: ReactNode; } interface State { hasError: boolean; error: Error | null; } class ErrorBoundary extends Component { constructor(props: Props) { super(props); this.state = { hasError: false, error: null }; } static getDerivedStateFromError(error: Error): State { return { hasError: true, error }; } componentDidCatch(error: Error, errorInfo: ErrorInfo) { console.error('ErrorBoundary caught error:', error, errorInfo); // TODO: Send to error tracking service (Sentry, LogRocket, etc.) } render() { if (this.state.hasError) { return ( this.props.fallback || (

Something went wrong

We're sorry, but something unexpected happened. Please refresh the page.

) ); } return this.props.children; } } export default ErrorBoundary;