File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55// but the content (bus location details) changes dynamically
66// based on which bus was selected.
77// This approach avoids creating multiple static pages and keeps the code DRY.
8- export default function Home ( ) {
8+ // app/bus/[busNumber]/page.tsx
9+
10+ export async function generateStaticParams ( ) {
11+ return [
12+ { busNumber : '1' } ,
13+ { busNumber : '2' } ,
14+ { busNumber : '3' } ,
15+ // Add more known bus numbers here
16+ ] ;
17+ }
18+
19+ export default function BusPage ( { params } : { params : { busNumber : string } } ) {
920 return (
1021 < div >
22+ < h1 > Bus Number: { params . busNumber } </ h1 >
1123 < p >
12- In this dynamic page, when you click any bus button, the UI/UX for all bus locations remains the same.
13- We use a dynamic page system so that clicking on, for example, the "Bus 1" button redirects here,
14- but the displayed content updates to show the respective bus's location.
24+ In this dynamic page, the UI/UX remains consistent across all buses, but
25+ the content updates based on the bus number.
1526 </ p >
1627 </ div >
1728 ) ;
1829}
1930
2031
32+
2133// src/app/bus/[busNumber]/page.tsx
2234// import { notFound } from 'next/navigation';
2335
Original file line number Diff line number Diff line change 1- export default function Home ( ) {
1+ // app/bus/[busNumber]/page.tsx
2+
3+
4+ export async function generateStaticParams ( ) {
5+ return [
6+ { slug : '1' } ,
7+ { slug : '2' } ,
8+ { slug : '3' } ,
9+ // Add more known slugs/bus numbers
10+ ] ;
11+ }
12+
13+ export default function BusPage ( { params } : { params : { slug : string } } ) {
214 return (
315 < div >
16+ < h1 > Bus Number: { params . slug } </ h1 >
417 < p >
5- In this dynamic page, when you click any club button, the UI/UX for all club remains the same.
6- We use a dynamic page system so that clicking on
18+ In this dynamic page, the UI/UX remains consistent across all buses, but
19+ the content updates based on the bus number.
720 </ p >
821 </ div >
922 ) ;
1023}
1124
25+
1226// import { notFound } from 'next/navigation';
1327
1428// // Mock data for clubs (replace with actual data fetching logic)
You can’t perform that action at this time.
0 commit comments