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 11import React from 'react' ;
2- import { render } from 'react-dom' ;
2+ import { createRoot } from 'react-dom/client ' ;
33
44import { About } from './about' ;
55import { Home } from './home' ;
@@ -42,4 +42,9 @@ const App = () => {
4242 ) ;
4343} ;
4444
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 11import { createHashHistory as createHashHistory4 } from 'history' ;
22import { createHashHistory as createHashHistory5 } from 'history-5' ;
33import React from 'react' ;
4- import { render } from 'react-dom' ;
4+ import { createRoot } from 'react-dom/client ' ;
55
66import { About } from './about' ;
77import { Home } from './home' ;
@@ -42,4 +42,9 @@ const App = () => {
4242 ) ;
4343} ;
4444
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 11import React from 'react' ;
2- import { render } from 'react-dom' ;
2+ import { createRoot } from 'react-dom/client ' ;
33
44import { shouldReloadWhenRouteMatchChanges } from '../../src/utils' ;
55
@@ -68,4 +68,9 @@ const App = () => {
6868 ) ;
6969} ;
7070
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 11import { createMemoryHistory } from 'history' ;
22import React from 'react' ;
3- import { render } from 'react-dom' ;
3+ import { createRoot } from 'react-dom/client ' ;
44import { defaultRegistry } from 'react-sweet-state' ;
55
66import { homeRoute } from './routes' ;
@@ -53,7 +53,12 @@ const main = async () => {
5353 ) ;
5454 } ;
5555
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 /> ) ;
5762} ;
5863
5964main ( ) ;
Original file line number Diff line number Diff line change 11import React from 'react' ;
2- import { render } from 'react-dom' ;
2+ import { createRoot } from 'react-dom/client ' ;
33
44import { homeRoute , aboutRoute } from './routes' ;
55
@@ -28,4 +28,9 @@ const App = () => {
2828 ) ;
2929} ;
3030
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