From cf6002c4cc5184f3eb86fa898a84c99a58494965 Mon Sep 17 00:00:00 2001 From: Andy O'Neill Date: Tue, 1 Aug 2023 12:10:04 +0000 Subject: [PATCH] [React] Update to v18 syntax Updated after seeing a linter deprecation warning, using this guide: https://react.dev/blog/2022/03/08/react-18-upgrade-guide#updates-to-client-rendering-apis --- react/src/index.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/react/src/index.jsx b/react/src/index.jsx index d9a01e8..24ecb18 100644 --- a/react/src/index.jsx +++ b/react/src/index.jsx @@ -1,5 +1,5 @@ import React from "react"; -import { render } from "react-dom"; +import { createRoot } from "react-dom/client"; import { BrowserRouter, Navigate, Route, Routes } from "react-router-dom"; import { Playlist } from "./playlist"; @@ -30,9 +30,10 @@ function App() { ); } -render( +const container = document.getElementById("index"); +const root = createRoot(container); +root.render( , - document.getElementById("index"), );