fix(web): update client rendering method (#3106)

This PR utilises the React 18 Client Rendering API along with createRoot as opposed to the React 17 ReactDOM.render method.
pull/3087/head^2
Amir Zarrinkafsh 2022-04-04 09:39:18 +10:00 committed by GitHub
parent ec8d71f63f
commit fa143ea029
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -1,13 +1,14 @@
import React from "react"; import React from "react";
import ReactDOM from "react-dom"; import { createRoot } from "react-dom/client";
import "@root/index.css"; import "@root/index.css";
import App from "@root/App"; import App from "@root/App";
import * as serviceWorker from "@root/serviceWorker"; import * as serviceWorker from "@root/serviceWorker";
import "./i18n/index.ts"; import "@i18n/index.ts";
ReactDOM.render(<App />, document.getElementById("root")); const root = createRoot(document.getElementById("root")!);
root.render(<App />);
// If you want your app to work offline and load faster, you can change // If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls. // unregister() to register() below. Note this comes with some pitfalls.