Switch to the React 18 createRoot API
This commit is contained in:
parent
0d22ef2104
commit
14a1ff7fe4
1 changed files with 8 additions and 7 deletions
15
src/main.tsx
15
src/main.tsx
|
@ -20,8 +20,8 @@ limitations under the License.
|
||||||
// dependency references.
|
// dependency references.
|
||||||
import "matrix-js-sdk/src/browser-index";
|
import "matrix-js-sdk/src/browser-index";
|
||||||
|
|
||||||
import React from "react";
|
import React, { StrictMode } from "react";
|
||||||
import ReactDOM from "react-dom";
|
import { createRoot } from "react-dom/client";
|
||||||
import { createBrowserHistory } from "history";
|
import { createBrowserHistory } from "history";
|
||||||
import * as Sentry from "@sentry/react";
|
import * as Sentry from "@sentry/react";
|
||||||
import { Integrations } from "@sentry/tracing";
|
import { Integrations } from "@sentry/tracing";
|
||||||
|
@ -39,6 +39,8 @@ initRageshake();
|
||||||
|
|
||||||
console.info(`matrix-video-chat ${import.meta.env.VITE_APP_VERSION || "dev"}`);
|
console.info(`matrix-video-chat ${import.meta.env.VITE_APP_VERSION || "dev"}`);
|
||||||
|
|
||||||
|
const root = createRoot(document.getElementById("root")!);
|
||||||
|
|
||||||
let fatalError: Error | null = null;
|
let fatalError: Error | null = null;
|
||||||
|
|
||||||
if (!window.isSecureContext) {
|
if (!window.isSecureContext) {
|
||||||
|
@ -52,7 +54,7 @@ if (!window.isSecureContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fatalError !== null) {
|
if (fatalError !== null) {
|
||||||
ReactDOM.render(<>fatalError.message</>, document.getElementById("root"));
|
root.render(fatalError.message);
|
||||||
throw fatalError; // Stop the app early
|
throw fatalError; // Stop the app early
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,9 +149,8 @@ i18n
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
ReactDOM.render(
|
root.render(
|
||||||
<React.StrictMode>
|
<StrictMode>
|
||||||
<App history={history} />
|
<App history={history} />
|
||||||
</React.StrictMode>,
|
</StrictMode>
|
||||||
document.getElementById("root")
|
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue