From fcc333d0cc14a03da5ccbe6f38e1359f14bc4e98 Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Tue, 8 Nov 2022 00:51:25 +0300
Subject: react-dom: conditional create/hydrate root based on the initial props
---
vnext/src/index.js | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/vnext/src/index.js b/vnext/src/index.js
index fd5024c9..11a78a48 100644
--- a/vnext/src/index.js
+++ b/vnext/src/index.js
@@ -9,7 +9,7 @@ import 'core-js/modules/es.symbol';
import 'core-js/modules/web.dom-collections.iterator';
import 'url-polyfill';
import { StrictMode, lazy } from 'react';
-import { hydrateRoot } from 'react-dom/client';
+import { createRoot, hydrateRoot } from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import { CookiesProvider } from 'react-cookie';
@@ -40,4 +40,9 @@ const JuickApp = () => (
);
-hydrateRoot(document.getElementById('app'), );
+let root = document.getElementById('app');
+if (window.__PROPS__) {
+ hydrateRoot(root, );
+} else {
+ createRoot(root).render();
+}
--
cgit v1.2.3