Need Assistance?

support@tutorialshub.in

App Router & File-Based Routing

Dynamic Routes ([slug] & [id])

ADVERTISEMENT
Next.js Free Lesson
5 min read
ADVERTISEMENT

Imagine you have 500 blog posts or 1,000 products. You obviously wouldn't create 1,000 separate folders! Instead, wrap a folder name in square brackets like [slug] or [id].

Next.js passes the matched URL value to your page component inside the params prop. Remember that in Next.js 15+, params is a Promise, so we await params inside an async component.

ADVERTISEMENT
Hi, I'm Tuby! Here to help you