File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { Route , Routes } from "react-router" ;
2- import About from "./views/About" ;
32import Main from "./views/Main" ;
43import NotFound from "./views/NotFound" ;
5- import View from "./views/View" ;
64import "@mantine/core/styles.css" ;
75import "@mantine/dropzone/styles.css" ;
86import "@mantine/code-highlight/styles.css" ;
7+ import { lazy , Suspense } from "react" ;
8+ import Loading from "./views/Loading" ;
9+
10+ const AboutPage = lazy ( ( ) => import ( "./views/About" ) ) ;
11+ const ViewPage = lazy ( ( ) => import ( "./views/View" ) ) ;
912
1013function App ( ) {
1114 return (
1215 < Routes >
1316 < Route path = "/" element = { < Main /> } />
14- < Route path = "/about" element = { < About / >} />
15- < Route path = "/:link" element = { < View / >} />
17+ < Route path = "/about" element = { < Suspense fallback = { < Loading /> } > < AboutPage /> </ Suspense > } />
18+ < Route path = "/:link" element = { < Suspense fallback = { < Loading /> } > < ViewPage /> </ Suspense > } />
1619 < Route path = "*" element = { < NotFound /> } />
1720 </ Routes >
1821 ) ;
Original file line number Diff line number Diff line change 1+ import { Container , Flex , Loader } from "@mantine/core" ;
2+ import Header from "../components/Header" ;
3+
4+ function Loading ( ) {
5+ return (
6+ < >
7+ < Header small />
8+ < Container my = { 20 } >
9+ < Flex w = "100%" h = "100%" justify = "center" align = "center" >
10+ < Loader size = "lg" />
11+ </ Flex >
12+ </ Container >
13+ </ >
14+ ) ;
15+ }
16+
17+ export default Loading ;
You can’t perform that action at this time.
0 commit comments