mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
## Description At #72178, [TypeScript](https://nextjs.org/docs/app/api-reference/config/typescript) docs was moved. So update the old URLs. ### Improving Documentation - [x] Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - [x] Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide --------- Co-authored-by: Zack Tanner <[email protected]>
Dynamic Routing example
This example shows how to do dynamic routing in Next.js. It contains two dynamic routes:
app/post/[id]/page.tsx- e.g. matches
/post/my-example(/post/:id)
- e.g. matches
app/post/[id]/[comment]/page.tsx- e.g. matches
/post/my-example/a-comment(/post/:id/:comment)
- e.g. matches
These routes are automatically matched by the server.
You can use next/link as displayed in this example to route to these pages client side.
Deploy your own
Deploy the example using Vercel or preview live with StackBlitz
How to use
Execute create-next-app with npm, Yarn, or pnpm to bootstrap the example:
npx create-next-app --example dynamic-routing dynamic-routing-app
yarn create next-app --example dynamic-routing dynamic-routing-app
pnpm create next-app --example dynamic-routing dynamic-routing-app
Deploy it to the cloud with Vercel (Documentation).