File tree Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change 1
1
import React from "react" ;
2
2
import ReactDom from "react-dom/client" ;
3
+ import { BrowserRouter , Routes , Route } from "react-router-dom" ;
3
4
import App1 from "./f0" ;
4
- import App2 from "./f1" ;
5
- import App3 from "./f2" ;
6
- import App4 from "./f3" ;
7
- import './index.css'
5
+ import "./index.css" ;
6
+
7
+ const App2 = React . lazy ( ( ) => import ( "./f1" ) ) ;
8
+ const App3 = React . lazy ( ( ) => import ( "./f2" ) ) ;
9
+ const App4 = React . lazy ( ( ) => import ( "./f3" ) ) ;
8
10
9
11
ReactDom . createRoot ( document . getElementById ( "root" ) ) . render (
10
12
< React . StrictMode >
11
- < App1 />
12
- < App2 />
13
- < App3 />
14
- < App4 />
13
+ < BrowserRouter >
14
+ < App1 />
15
+ < React . Suspense fallback = { < div > Loading...</ div > } >
16
+ < Routes >
17
+ < Route path = "/f1" element = { < App2 /> } />
18
+ < Route path = "/f2" element = { < App3 /> } />
19
+ < Route path = "/f3" element = { < App4 /> } />
20
+ </ Routes >
21
+ </ React . Suspense >
22
+ </ BrowserRouter >
15
23
</ React . StrictMode >
16
24
) ;
You can’t perform that action at this time.
0 commit comments