Add video
This commit is contained in:
parent
589de0c5ac
commit
7c36cbfdd4
18 changed files with 2292 additions and 333 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { createRoot, hydrateRoot } from 'react-dom/client';
|
||||
import App from './App';
|
||||
import './i18n';
|
||||
import { INITIAL_LANGUAGE, i18nReady } from './i18n';
|
||||
import './index.css';
|
||||
import './hooks/usePlausible';
|
||||
|
||||
|
|
@ -8,9 +8,21 @@ const container = document.getElementById('root');
|
|||
if (!container) {
|
||||
throw new Error('Root element not found');
|
||||
}
|
||||
const root = container;
|
||||
|
||||
if (container.children.length > 0) {
|
||||
hydrateRoot(container, <App />);
|
||||
} else {
|
||||
createRoot(container).render(<App />);
|
||||
function renderApp() {
|
||||
const hasPrerenderedMarkup = root.children.length > 0;
|
||||
|
||||
if (hasPrerenderedMarkup && INITIAL_LANGUAGE === 'en') {
|
||||
hydrateRoot(root, <App />);
|
||||
return;
|
||||
}
|
||||
|
||||
if (hasPrerenderedMarkup) {
|
||||
root.textContent = '';
|
||||
}
|
||||
|
||||
createRoot(root).render(<App />);
|
||||
}
|
||||
|
||||
void i18nReady.then(renderApp);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue