Add prerendering
This commit is contained in:
parent
0242722268
commit
a42591c701
6 changed files with 1009 additions and 48 deletions
|
|
@ -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 />);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue