File tree Expand file tree Collapse file tree 5 files changed +11960
-14
lines changed Expand file tree Collapse file tree 5 files changed +11960
-14
lines changed Original file line number Diff line number Diff line change 30
30
"start" : " react-scripts start" ,
31
31
"prebuild" : " npm run sitemap" ,
32
32
"build" : " react-scripts build" ,
33
+ "postbuild" : " react-snap" ,
33
34
"test" : " react-scripts test" ,
34
35
"eject" : " react-scripts eject" ,
35
36
"sitemap" : " babel-node ./sitemap-gen.js"
66
67
"fs" : " ^0.0.1-security" ,
67
68
"path" : " ^0.12.7" ,
68
69
"prettier" : " ^2.6.2" ,
69
- "react-app-rewired" : " ^2.2.1"
70
+ "react-app-rewired" : " ^2.2.1" ,
71
+ "react-snap" : " ^1.23.0"
70
72
}
71
73
}
Original file line number Diff line number Diff line change @@ -15,8 +15,8 @@ function Reports() {
15
15
16
16
return (
17
17
< >
18
- < div >
19
- < h2 > Reports</ h2 >
18
+ { /* <div>
19
+ <h2>Reports</h2>
20
20
<ul>
21
21
<li>
22
22
<Link to={`${url}/profitloss` }>Profit and Loss</Link>
@@ -37,7 +37,7 @@ function Reports() {
37
37
<Report />
38
38
</Route>
39
39
</Switch>
40
- </ div >
40
+ </div> */ }
41
41
< SyntaxHighlighter language = "javascript" style = { github } >
42
42
{ `import {
43
43
BrowserRouter as Router,
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
- import ReactDOM from 'react-dom/client' ;
2
+ import { createRoot , hydrateRoot } from 'react-dom/client' ;
3
3
import { BrowserRouter as Router } from 'react-router-dom' ;
4
4
import App from './App' ;
5
5
import ScrollToTop from './ScrollToTop' ;
6
6
7
- ReactDOM . createRoot ( document . getElementById ( 'root' ) ) . render (
8
- < Router >
9
- < ScrollToTop >
10
- < App />
11
- </ ScrollToTop >
12
- </ Router >
13
- ) ;
7
+ const container = document . getElementById ( 'root' ) ;
8
+
9
+ if ( container . hasChildNodes ( ) ) {
10
+ hydrateRoot (
11
+ container ,
12
+ < Router >
13
+ < ScrollToTop >
14
+ < App />
15
+ </ ScrollToTop >
16
+ </ Router >
17
+ ) ;
18
+ } else {
19
+ createRoot ( container ) . render (
20
+ < Router >
21
+ < ScrollToTop >
22
+ < App />
23
+ </ ScrollToTop >
24
+ </ Router >
25
+ ) ;
26
+ }
Original file line number Diff line number Diff line change @@ -3269,7 +3269,7 @@ export default Route;
3269
3269
3270
3270
< Chapter12 . ViewLocation />
3271
3271
</ Route >
3272
- < Route path = "/listing1216" >
3272
+ { /* <Route path="/listing1216">
3273
3273
<Helmet>
3274
3274
<title>
3275
3275
ReactJS Foundations: Dynamic Links and Routes in nested Routes
@@ -3279,7 +3279,7 @@ export default Route;
3279
3279
<PrevNext prev="/listing1215" next="/listing1301" />
3280
3280
3281
3281
<Chapter12.NestedRoutes />
3282
- </ Route >
3282
+ </Route> */ }
3283
3283
< Route path = "/listing1301" >
3284
3284
< Helmet >
3285
3285
< title > ReactJS Foundations: An ErrorBoundary component</ title >
You can’t perform that action at this time.
0 commit comments