Skip to content

Commit

Permalink
Use createRoot instead of deprecated ReactDOM.render
Browse files Browse the repository at this point in the history
I foresee this change being made across the codebase shortly
and want to proactively prevent my PR from falling behind
  • Loading branch information
taffyko committed Oct 22, 2024
1 parent 3541391 commit 16ad814
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/views/messages/TextualBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -255,7 +256,7 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
{after}
</>
);
ReactDOM.render(newContent, container);
createRoot(container).render(newContent);

node.parentNode?.replaceChild(container, node);
} else if (node.childNodes && node.childNodes.length) {
Expand Down

0 comments on commit 16ad814

Please sign in to comment.