File tree Expand file tree Collapse file tree 9 files changed +257
-185
lines changed Expand file tree Collapse file tree 9 files changed +257
-185
lines changed Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
- import { render } from 'react-dom' ;
2
+ import { createRoot } from 'react-dom/client ' ;
3
3
4
4
import { About } from './about' ;
5
5
import { Home } from './home' ;
@@ -42,4 +42,9 @@ const App = () => {
42
42
) ;
43
43
} ;
44
44
45
- render ( < App /> , document . getElementById ( 'root' ) ) ;
45
+ const container = document . getElementById ( 'root' ) ;
46
+ if ( ! container )
47
+ throw new Error ( 'No root element found to render basic routing example' ) ;
48
+
49
+ const root = createRoot ( container ) ;
50
+ root . render ( < App /> ) ;
Original file line number Diff line number Diff line change 1
1
import { createHashHistory as createHashHistory4 } from 'history' ;
2
2
import { createHashHistory as createHashHistory5 } from 'history-5' ;
3
3
import React from 'react' ;
4
- import { render } from 'react-dom' ;
4
+ import { createRoot } from 'react-dom/client ' ;
5
5
6
6
import { About } from './about' ;
7
7
import { Home } from './home' ;
@@ -42,4 +42,9 @@ const App = () => {
42
42
) ;
43
43
} ;
44
44
45
- render ( < App /> , document . getElementById ( 'root' ) ) ;
45
+ const container = document . getElementById ( 'root' ) ;
46
+ if ( ! container )
47
+ throw new Error ( 'No root element found to render hash routing example' ) ;
48
+
49
+ const root = createRoot ( container ) ;
50
+ root . render ( < App /> ) ;
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
- import { render } from 'react-dom' ;
2
+ import { createRoot } from 'react-dom/client ' ;
3
3
4
4
import { shouldReloadWhenRouteMatchChanges } from '../../src/utils' ;
5
5
@@ -68,4 +68,9 @@ const App = () => {
68
68
) ;
69
69
} ;
70
70
71
- render ( < App /> , document . getElementById ( 'root' ) ) ;
71
+ const container = document . getElementById ( 'root' ) ;
72
+ if ( ! container )
73
+ throw new Error ( 'No root element found to render hooks example' ) ;
74
+
75
+ const root = createRoot ( container ) ;
76
+ root . render ( < App /> ) ;
Original file line number Diff line number Diff line change 1
1
import { createMemoryHistory } from 'history' ;
2
2
import React from 'react' ;
3
- import { render } from 'react-dom' ;
3
+ import { createRoot } from 'react-dom/client ' ;
4
4
import { defaultRegistry } from 'react-sweet-state' ;
5
5
6
6
import { homeRoute } from './routes' ;
@@ -53,7 +53,12 @@ const main = async () => {
53
53
) ;
54
54
} ;
55
55
56
- render ( < App /> , document . getElementById ( 'root' ) ) ;
56
+ const container = document . getElementById ( 'root' ) ;
57
+ if ( ! container )
58
+ throw new Error ( 'No root element found to render hydration example' ) ;
59
+
60
+ const root = createRoot ( container ) ;
61
+ root . render ( < App /> ) ;
57
62
} ;
58
63
59
64
main ( ) ;
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
- import { render } from 'react-dom' ;
2
+ import { createRoot } from 'react-dom/client ' ;
3
3
4
4
import { homeRoute , aboutRoute } from './routes' ;
5
5
@@ -28,4 +28,9 @@ const App = () => {
28
28
) ;
29
29
} ;
30
30
31
- render ( < App /> , document . getElementById ( 'root' ) ) ;
31
+ const container = document . getElementById ( 'root' ) ;
32
+ if ( ! container )
33
+ throw new Error ( 'No root element found to render resources example' ) ;
34
+
35
+ const root = createRoot ( container ) ;
36
+ root . render ( < App /> ) ;
You can’t perform that action at this time.
0 commit comments