import React from 'react'; interface ErrorBoundaryState { hasError: boolean; error?: Error; } class ErrorBoundary extends React.Component { constructor(props: React.PropsWithChildren) { super(props); this.state = { hasError: false }; } static getDerivedStateFromError(error: Error): ErrorBoundaryState { return { hasError: true, error }; } componentDidCatch(error: Error, info: React.ErrorInfo) { // Log detailed error to console so we can see stack instead of generic "Script error" console.error('App crashed with error:', error, info); } render() { if (this.state.hasError) { return (

Algo salió mal

Se produjo un error inesperado. Intenta recargar la página.

{this.state.error && (
                {this.state.error.message}\n{this.state.error.stack}
              
)}
); } return this.props.children; } } export default ErrorBoundary;