Next.js · Junior · Question 6 of 75

How do you create a dynamic route /blog/:slug?

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.

Further reading

Problem with a question

Next.js · Junior · question 6

Test yourself

Take the Next.js · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz