Dynamic Routing:
Pages are created using a [param]
folder or file naming convention (e.g., app/blog/[id]/page.tsx
), where the dynamic segment (id
) is automatically parsed from the URL.
Data Fetching Options:
You can fetch data either on the server or on the client side. This means you can combine dynamic routing with Server Component fetch or Client Component fetch methods, depending on your requirements.
Using params
:
The dynamic value is passed into your component through a params
prop in Server Components or extracted using useParams()
in Client Components.