Add prerendering

This commit is contained in:
Andras Schmelczer 2026-02-03 19:25:41 +00:00
parent 0242722268
commit a42591c701
6 changed files with 1009 additions and 48 deletions

View file

@ -1,4 +1,4 @@
import { createRoot } from 'react-dom/client';
import { createRoot, hydrateRoot } from 'react-dom/client';
import App from './App';
import './index.css';
import { initPlausible } from './usePlausible';
@ -9,5 +9,9 @@ const container = document.getElementById('root');
if (!container) {
throw new Error('Root element not found');
}
const root = createRoot(container);
root.render(<App />);
if (container.children.length > 0) {
hydrateRoot(container, <App />);
} else {
createRoot(container).render(<App />);
}