import React, { Component, ErrorInfo, ReactNode } from 'react'; import ReactDOM from 'react-dom/client'; import App from './App'; class ErrorBoundary extends Component<{ children: ReactNode }, { hasError: boolean; error: Error | null }> { constructor(props: { children: ReactNode }) { super(props); this.state = { hasError: false, error: null }; } static getDerivedStateFromError(error: Error) { return { hasError: true, error }; } componentDidCatch(error: Error, errorInfo: ErrorInfo) { console.error("Uncaught error:", error, errorInfo); } render() { if (this.state.hasError) { return (

Oh fudge! 🍬

We dropped the lollipop. Something went wrong while loading the shop.

Error Details:

                {this.state.error?.message || "Unknown error"}
              
); } return this.props.children; } } const rootElement = document.getElementById('root'); if (!rootElement) { throw new Error("Could not find root element to mount to"); } const root = ReactDOM.createRoot(rootElement); root.render( );