File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 11import * as React from "react" ;
22import * as ReactDOM from "react-dom" ;
3+ import { createRoot , Root } from "react-dom/client" ;
34import CategoryPillComponent , { CategoryPillState } from "../components/CategoryPillComponent" ;
45import Config from "../config" ;
56import { VoteResponse } from "../messageTypes" ;
@@ -10,6 +11,7 @@ import { Tooltip } from "./Tooltip";
1011export class CategoryPill {
1112 container : HTMLElement ;
1213 ref : React . RefObject < CategoryPillComponent > ;
14+ root : Root ;
1315
1416 unsavedState : CategoryPillState ;
1517
@@ -38,10 +40,8 @@ export class CategoryPill {
3840 this . unsavedState = this . ref . current . state ;
3941 }
4042
41- ReactDOM . render (
42- < CategoryPillComponent ref = { this . ref } vote = { vote } /> ,
43- this . container
44- ) ;
43+ this . root = createRoot ( this . container ) ;
44+ this . root . render ( < CategoryPillComponent ref = { this . ref } vote = { vote } /> ) ;
4545
4646 if ( this . unsavedState ) {
4747 this . ref . current ?. setState ( this . unsavedState ) ;
@@ -64,7 +64,7 @@ export class CategoryPill {
6464 }
6565
6666 close ( ) : void {
67- ReactDOM . unmountComponentAtNode ( this . container ) ;
67+ this . root . unmount ( ) ;
6868 this . container . remove ( ) ;
6969 }
7070
You can’t perform that action at this time.
0 commit comments