Next.js · Junior · Question 6 of 75
How do you create a dynamic route /blog/:slug?
- ✓Correct answer: The folder
app/blog/[slug]/page.tsx - 2The folder
app/blog/:slug/page.tsx - 3The folder
app/blog/{slug}/page.tsx
Explanation
A dynamic segment is a folder name in square brackets. The value arrives in params. [...slug] catches several segments; [[...slug]] does the same but also matches the route without segments. Colons and curly braces are other routers' syntax.