Use createRoot instead of deprecated ReactDOM.render

I foresee this change being made across the codebase shortly
and want to proactively prevent my PR from falling behind
This commit is contained in:
taffyko 2024-10-22 13:48:10 -07:00
parent 3541391747
commit 16ad8146c5

View file

@ -8,6 +8,7 @@ Please see LICENSE files in the repository root for full details.
import React, { createRef, SyntheticEvent, MouseEvent } from "react"; import React, { createRef, SyntheticEvent, MouseEvent } from "react";
import ReactDOM from "react-dom"; import ReactDOM from "react-dom";
import { createRoot } from "react-dom/client";
import { MsgType, PushRuleKind } from "matrix-js-sdk/src/matrix"; import { MsgType, PushRuleKind } from "matrix-js-sdk/src/matrix";
import { TooltipProvider } from "@vector-im/compound-web"; import { TooltipProvider } from "@vector-im/compound-web";
import { globToRegexp } from "matrix-js-sdk/src/utils"; import { globToRegexp } from "matrix-js-sdk/src/utils";
@ -255,7 +256,7 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
{after} {after}
</> </>
); );
ReactDOM.render(newContent, container); createRoot(container).render(newContent);
node.parentNode?.replaceChild(container, node); node.parentNode?.replaceChild(container, node);
} else if (node.childNodes && node.childNodes.length) { } else if (node.childNodes && node.childNodes.length) {