File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 11import * as React from "react" ;
22import { Component , createRef , RefObject } from "react" ;
3- import { Grid as Gridjs , UserConfig } from "gridjs" ;
3+ import { Grid as Gridjs , Config } from "gridjs" ;
44
5- class Grid extends Component < Partial < UserConfig > , any > {
5+ class Grid extends Component < Partial < Config > , any > {
66 private wrapper : RefObject < HTMLDivElement > = createRef ( ) ;
77 // Grid.js instance
88 private readonly instance = null ;
@@ -18,6 +18,11 @@ class Grid extends Component<Partial<UserConfig>, any> {
1818 }
1919
2020 componentDidMount ( ) : void {
21+ // prevent gridjs from complaining that the container is not empty
22+ if ( this . wrapper . current . childNodes . length > 0 ) {
23+ this . wrapper . current . innerHTML = '' ;
24+ }
25+
2126 this . instance . render ( this . wrapper . current ) ;
2227 }
2328
Original file line number Diff line number Diff line change 11import { h , createRef as gCreateRef , Component as gComponent } from "gridjs" ;
2- import ReactDOM from "react-dom" ;
2+ import { createRoot } from "react-dom/client " ;
33
44
55export class ReactWrapper extends gComponent < {
@@ -13,7 +13,8 @@ export class ReactWrapper extends gComponent<{
1313 ref = gCreateRef ( ) ;
1414
1515 componentDidMount ( ) : void {
16- ReactDOM . render ( this . props . element , this . ref . current ) ;
16+ const root = createRoot ( this . ref . current ) ;
17+ root . render ( this . props . element ) ;
1718 }
1819
1920 render ( ) {
You can’t perform that action at this time.
0 commit comments