import {StrictMode} from 'react'; import {createRoot, hydrateRoot} from 'react-dom/client'; import App from './App.tsx'; import './index.css'; const root = document.getElementById('root')!; const app = ( ); // Prerendered pages record their route; "*" is the 404 page, which fits any unknown URL. // Anything else (the dev server, or a host falling back to index.html) renders from scratch. const prerendered = root.dataset.prerendered; const currentPath = location.pathname.length > 1 ? location.pathname.replace(/\/+$/, '') : location.pathname; if (prerendered === '*' || prerendered === currentPath) { hydrateRoot(root, app); } else { root.textContent = ''; createRoot(root).render(app); }