How do you create a dynamic route in Next.js?
Instruction: Explain the process of creating a dynamic route in a Next.js application.
Context: Dynamic routing is a foundational concept in Next.js. This question tests the candidate's knowledge of the syntax and process for setting up dynamic routes.
Updated
Official answer available
Read the opening below, then unlock the full answer and practical guidance.
A dynamic route matches a URL segment whose value is not fixed in the folder name. It does not, by itself, mean that the page must be rendered on every request.
In the current App Router, app/posts/[slug]/page.jsx matches /posts/welcome. The params prop is a Promise, so an async page awaits it...
Related Questions
-
easy
-
easy
-
easy
-
easy
-
medium
-
medium