From 6b9d8f619008f1143a97e77cefa1b5905bd551dc Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Sat, 6 Aug 2022 23:40:59 -0300 Subject: [PATCH] Opt-into react 18 concurrent renderer --- src/index.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index 11695da..5e98cce 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,5 +1,5 @@ import React from "react"; -import ReactDOM from "react-dom"; +import { createRoot } from "react-dom/client"; import { HelmetProvider, Helmet } from "react-helmet-async"; import "@fontsource/space-grotesk/index.css"; import "@fontsource/roboto/index.css"; @@ -9,7 +9,9 @@ import "./index.css"; import App from "./App"; import reportWebVitals from "./reportWebVitals"; -ReactDOM.render( +const container = document.getElementById("root"); +const root = createRoot(container!); +root.render( @@ -23,8 +25,7 @@ ReactDOM.render( - , - document.getElementById("root") + ); // If you want to start measuring performance in your app, pass a function