-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
what is the difference between [id].js and [...id].js and [[...id]].js ? #3
Comments
both [id].js and [...id].js are used for dynamic routing, but they serve slightly different purposes.
This is used for a single dynamic segment in the URL. Example:
|
This is used for catching all subsequent segments in the URL. Example:
|
[id].js
: For example, a blog could include the following route pages/blog/[slug].js where [slug] is the Dynamic Segment for blog posts.[...id].js
: Dynamic Segments can be extended to catch-all subsequent segments by adding an ellipsis inside the brackets [...segmentName].[[...id]].js
: Catch-all Segments can be made optional by including the parameter in double square brackets: [[...segmentName]].The text was updated successfully, but these errors were encountered: