From e33d578f5317c3f4cb40ede542e85374092e9ef5 Mon Sep 17 00:00:00 2001 From: wooferzfg Date: Tue, 28 May 2024 17:33:19 -0500 Subject: [PATCH] Update index.tsx for React 18 interface Also no longer use toast.POSITION since it was removed in v10 --- src/index.tsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index 2155dc7..854c80a 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -29,12 +29,12 @@ try { const [ { LiveSplit }, React, - ReactDOM, - { toast, ToastContainer }, + { createRoot }, + { ToastContainer }, ] = await Promise.all([ import("./ui/LiveSplit"), import("react"), - import("react-dom"), + import("react-dom/client"), import("react-toastify"), ]); @@ -81,7 +81,9 @@ try { // should still have the fallback fonts that we can fall back to. } - ReactDOM.render( + const container = document.getElementById("base"); + const root = createRoot(container!); + root.render(
, - document.getElementById("base"), ); } catch (e: any) { if (e.name === "InvalidStateError") {