Dynamic Routes
The address itself decides what the page shows. Any segment in
/docs/… is captured by the [slug] folder and passed to the page as a parameter: the pattern behind docs, blog posts, profiles and product pages.Expected behaviour
Go to an address like
/docs/anything and the part after /docs/ becomes the slug. This page just shows it; a real app would use it to load the right content from a database, CMS or files.How this page works
- 1The folder name
[slug]tells Next.js it's a dynamic route. - 2That part of the address is captured as
params.slug. - 3The page receives
paramsfrom Next.js automatically. - 4The slug is shown on the page.