Problem Statement
How do you create a dynamic route in Next.js Pages Router?
Explanation
Dynamic routes are created by wrapping the dynamic segment name in square brackets in the filename, like pages/blog/[slug].js which matches /blog/hello, /blog/world, etc, and the dynamic value is accessible through the router query object.
You can also create catch-all routes with [...slug].js that match multiple segments, or optional catch-all with [[...slug]].js. This pattern enables creating pages for dynamic content like blog posts, user profiles, or product pages without manually creating files for each route.