Skip to content

Virtual whiteboard for sketching hand-drawn like diagrams

docs: migrate the example to React 18 (#5533)

Aakansha Doshi0a5da0269f70
diff --git a/src/packages/excalidraw/example/index.tsx b/src/packages/excalidraw/example/index.tsx
index 902838acde..825a1016e7 100644
--- a/src/packages/excalidraw/example/index.tsx
+++ b/src/packages/excalidraw/example/index.tsx
@@ -1,12 +1,13 @@
-import React from "react";
-import ReactDOM from "react-dom";
+import { StrictMode } from "react";
+import { createRoot } from "react-dom/client";
import App from "./App";
-const rootElement = document.getElementById("root");
-ReactDOM.render(
- <React.StrictMode>
+const rootElement = document.getElementById("root")!;
+const root = createRoot(rootElement);
+
+root.render(
+ <StrictMode>
<App />
- </React.StrictMode>,
- rootElement,
+ </StrictMode>,
);
diff --git a/src/packages/excalidraw/example/public/index.html b/src/packages/excalidraw/example/public/index.html
index 5256209e39..7f4ed24942 100644
--- a/src/packages/excalidraw/example/public/index.html
+++ b/src/packages/excalidraw/example/public/index.html
@@ -17,8 +17,8 @@
<body>
<noscript> You need to enable JavaScript to run this app. </noscript>
<div id="root"></div>
- <script src="https://unpkg.com/[email protected]/umd/react.development.js"></script>
- <script src="https://unpkg.com/[email protected]/umd/react-dom.development.js"></script>
+ <script src="https://unpkg.com/[email protected]/umd/react.development.js"></script>
+ <script src="https://unpkg.com/[email protected]/umd/react-dom.development.js"></script>
<!-- This is so that we use the bundled excalidraw.development.js file instead
of the actual source code -->