File tree Expand file tree Collapse file tree 3 files changed +44
-1
lines changed Expand file tree Collapse file tree 3 files changed +44
-1
lines changed Original file line number Diff line number Diff line change 1+ import { useContext } from "react" ;
2+ import { useParams , Link } from "react-router-dom" ;
3+ import reactLogo from "~/assets/react.svg" ;
4+ import Context from "~/context" ;
5+
6+ export default function Home ( ) {
7+ const context = useContext ( Context ) ;
8+
9+ return (
10+ < div className = "App" >
11+ < div >
12+ < a href = "https://vitejs.dev" target = "_blank" >
13+ < img src = "/logo.svg" className = "logo" alt = "Vite logo" />
14+ </ a >
15+ < a href = "https://reactjs.org" target = "_blank" >
16+ < img src = { reactLogo } className = "logo react" alt = "React logo" />
17+ </ a >
18+ </ div >
19+ < h1 > Vite + React</ h1 >
20+ < div className = "list" >
21+ < p > This page is prerendered.</ p >
22+ < p >
23+ Context generated on the server-side:
24+ < br /> < code > { JSON . stringify ( context ) } </ code >
25+ </ p >
26+ < p >
27+ Go back to < Link to = "/" > home page</ Link > .
28+ </ p >
29+ </ div >
30+ < p className = "powered-by" >
31+ Template by{ " " }
32+ < a
33+ href = "https://www.stormkit.io/"
34+ target = "_blank"
35+ rel = "noopener noreferrer"
36+ >
37+ < img src = "/stormkit-logo.svg" />
38+ </ a >
39+ </ p >
40+ </ div >
41+ ) ;
42+ }
Original file line number Diff line number Diff line change 44// Check import.meta.glob provided by Vite to scan folders dynamically
55// and build the routes to be prerendered.
66
7- export default [ "/" , "/my-page" , "/my-other-page "] ;
7+ export default [ "/" , "/prerender " ] ;
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ type RouteExtended = RouteProps & {
1313
1414const routes : Route [ ] = [
1515 { path : "/" , import : ( ) => import ( "~/pages" ) } ,
16+ { path : "/prerender" , import : ( ) => import ( "~/pages/prerender" ) } ,
1617 { path : "/:name" , import : ( ) => import ( "~/pages/ssr" ) } ,
1718] ;
1819
You can’t perform that action at this time.
0 commit comments