import React from 'react'; /** * Catches render-time crashes so they surface as a readable message instead of a * white screen. React unmounts the whole tree when an error escapes, which is * indistinguishable from "the deploy didn't work" — this makes the difference * visible without opening devtools, which matters most on a hosted build where * the stack is minified and nobody is watching the console. */ class ErrorBoundary extends React.Component { constructor(props) { super(props); this.state = { error: null }; } static getDerivedStateFromError(error) { return { error }; } componentDidCatch(error, info) { console.error('Application crashed:', error, info?.componentStack); } render() { if (!this.state.error) { return this.props.children; } return (

Something went wrong

The application failed to render. The details below are also in the browser console.

            {String(this.state.error?.stack || this.state.error)}
          
); } } export default ErrorBoundary;