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 1
1
import * as React from "react" ;
2
2
import { Component , createRef , RefObject } from "react" ;
3
- import { Grid as Gridjs , UserConfig } from "gridjs" ;
3
+ import { Grid as Gridjs , Config } from "gridjs" ;
4
4
5
- class Grid extends Component < Partial < UserConfig > , any > {
5
+ class Grid extends Component < Partial < Config > , any > {
6
6
private wrapper : RefObject < HTMLDivElement > = createRef ( ) ;
7
7
// Grid.js instance
8
8
private readonly instance = null ;
@@ -18,6 +18,11 @@ class Grid extends Component<Partial<UserConfig>, any> {
18
18
}
19
19
20
20
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
+
21
26
this . instance . render ( this . wrapper . current ) ;
22
27
}
23
28
Original file line number Diff line number Diff line change 1
1
import { h , createRef as gCreateRef , Component as gComponent } from "gridjs" ;
2
- import ReactDOM from "react-dom" ;
2
+ import { createRoot } from "react-dom/client " ;
3
3
4
4
5
5
export class ReactWrapper extends gComponent < {
@@ -13,7 +13,8 @@ export class ReactWrapper extends gComponent<{
13
13
ref = gCreateRef ( ) ;
14
14
15
15
componentDidMount ( ) : void {
16
- ReactDOM . render ( this . props . element , this . ref . current ) ;
16
+ const root = createRoot ( this . ref . current ) ;
17
+ root . render ( this . props . element ) ;
17
18
}
18
19
19
20
render ( ) {
You can’t perform that action at this time.
0 commit comments