// src/components/ErrorBoundary.tsx import React, { Component, ErrorInfo, ReactNode } from 'react'; import { AlertTriangle } from 'lucide-react'; interface Props { children: ReactNode; } interface State { hasError: boolean; error?: Error; } class ErrorBoundary extends Component { public state: State = { hasError: false }; public static getDerivedStateFromError(error: Error): State { return { hasError: true, error }; } public componentDidCatch(error: Error, errorInfo: ErrorInfo) { console.error('ErrorBoundary caught an error:', error, errorInfo); } public render() { if (this.state.hasError) { return (

¡Oops! Algo salió mal

Ha ocurrido un error inesperado. Por favor, recarga la página.

{process.env.NODE_ENV === 'development' && (
Detalles del error
                    {this.state.error?.stack}
                  
)}
); } return this.props.children; } } export default ErrorBoundary;