From 16ad8146c5853231644a0252a6a6330c92c527a6 Mon Sep 17 00:00:00 2001 From: taffyko Date: Tue, 22 Oct 2024 13:48:10 -0700 Subject: [PATCH] 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 --- src/components/views/messages/TextualBody.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/views/messages/TextualBody.tsx b/src/components/views/messages/TextualBody.tsx index 23e3fa89da..a5d52abde1 100644 --- a/src/components/views/messages/TextualBody.tsx +++ b/src/components/views/messages/TextualBody.tsx @@ -8,6 +8,7 @@ Please see LICENSE files in the repository root for full details. import React, { createRef, SyntheticEvent, MouseEvent } from "react"; import ReactDOM from "react-dom"; +import { createRoot } from "react-dom/client"; import { MsgType, PushRuleKind } from "matrix-js-sdk/src/matrix"; import { TooltipProvider } from "@vector-im/compound-web"; import { globToRegexp } from "matrix-js-sdk/src/utils"; @@ -255,7 +256,7 @@ export default class TextualBody extends React.Component { {after} ); - ReactDOM.render(newContent, container); + createRoot(container).render(newContent); node.parentNode?.replaceChild(container, node); } else if (node.childNodes && node.childNodes.length) {