MSK Institute LogoMSK.Institute
HomeCourses
Book Free Demo➔Sign In
Free Demo➔
MSK Institute LogoMSK.Institute

Leading computer training academy in Shikohabad for software engineering, Python, web development, and digital literacy.

ISO 9001:2015 Certified Center
Follow & Connect
4.9

Programs & Admissions

  • All CoursesCatalog
  • Learning PathsRoadmaps
  • Student ProjectsShowcase
  • Live Classes & ScheduleLive
  • Upcoming Batches
  • Campuses & LocationsHub
  • Verify Certificates
  • Book Free Demo Class

Resources & Tools

  • Free Online Mock TestsAll Tests
  • NIELIT CCC Mock TestFree
  • Course & Career FinderQuiz
  • Study Material Hub
  • All MSK ToolsHub
  • Keyboard ShortcutsNew
  • TypeQuest Speed LabTyping
  • MSK Code PlaygroundCode
  • Interactive Tutorials
  • Quick Cheatsheets

Institute & Contact

  • About MSK Institute
  • Careers & InternshipsHiring
  • Publications & Blogs
  • Gali No. 3, Near Gyan Jyoti Public School,
    Adarsh Nagar, Shikohabad, Uttar Pradesh 283135
  • +91 83930 42166
  • mskshikohabad@gmail.com
  • Hours:Mon – Sat: 8:00 AM – 7:00 PM | Sun: 10:00 AM – 2:00 PM
  • 4.9 ★(38 Google Reviews)
© 2026 MSK Institute. All rights reserved.•Privacy Policy•Terms of Service•Disclaimer•Contact Us

Shikohabad's Leading Computer & Coding Academy

Home
Courses
Live
Material
Dynamic Routes ([id]), Catch-All Routes ([...slug]) & Route Groups ((group))0%
Study Materials
Next.js 15Progress 0%
1.1Next.js 15 Overview & App Router vs Pages Router Architecture1.2Core File Conventions: page.tsx, layout.tsx, template.tsx & not-found.tsx1.3Dynamic Routes ([id]), Catch-All Routes ([...slug]) & Route Groups ((group))1.4Streaming UI with loading.tsx and Suspense Boundaries
HomeTutorialsNext.js 15Dynamic Routes ([id]), Catch-All Routes ([...slug]) & Route Groups ((group))
Streaming UI with loading.tsx and Suspense Boundaries

Dynamic Routes ([id]), Catch-All Routes ([...slug]) & Route Groups ((group))

Beginner12 min read•Updated: 2026-11-18•By Er. Sumit Kumar (MSK Institute)
Study MaterialsCheatsheet

In the Next.js App Router, advanced routing patterns are defined using folder naming syntax: Square Brackets [param] for dynamic segments, Ellipses [...slug] for catch-all routes, and Parentheses (group) for organizing code without affecting the URL path.


1. Dynamic Route Segments: [param]

When a URL segment is dynamic (such as a blog post slug or user ID):

  • Folder: app/blog/[slug]/page.tsx
  • URL: /blog/learn-nextjs -> { slug: 'learn-nextjs' }
1// app/blog/[slug]/page.tsx
2interface PageProps {
3 params: Promise<{ slug: string }>;
4}
5 
6export default async function BlogPost({ params }: PageProps) {
7 // In Next.js 15, params is an asynchronous Promise!
8 const { slug } = await params;
9 
10 return (
11 <article className="max-w-3xl mx-auto py-8">
12 <h1 className="text-3xl font-bold">Article: {slug}</h1>
13 </article>
14 );
15}

2. Catch-All & Optional Catch-All Routes

1. Catch-All: [...slug]

Matches any number of subsequent path segments and returns them as a string array:

  • Folder: app/docs/[...slug]/page.tsx
  • Matches: /docs/getting-started -> { slug: ['getting-started'] }
  • Matches: /docs/api/v2/authentication -> { slug: ['api', 'v2', 'authentication'] }
  • Does NOT match /docs itself.

2. Optional Catch-All: [[...slug]] (Double Brackets)

Matches all sub-segments AND matches the parent route itself:

  • Matches: /docs -> { slug: undefined }
  • Matches: /docs/components/button -> { slug: ['components', 'button'] }

3. Route Groups: (groupName)

Route Groups allow organizing folders and sharing specific layouts without affecting the URL path:

1app/
2 ├── (marketing)/
3 │ ├── layout.tsx # Marketing layout (Hero header, pricing navbar)
4 │ ├── about/page.tsx -> URL: /about
5 │ └── pricing/page.tsx -> URL: /pricing
6 └── (dashboard)/
7 ├── layout.tsx # Authenticated layout (Sidebar, profile dropdown)
8 └── analytics/page.tsx -> URL: /analytics

Notice that neither (marketing) nor (dashboard) appears in the browser URL!


Interactive Quiz• Knowledge Check

Multiple Choice Questions

Question 1
In Next.js 15, how should route params and search searchParams be consumed inside an async Server Component page.tsx?
Question 2
Which folder naming pattern matches both /shop AND any deeply nested path like /shop/clothing/jackets/winter?
Question 3
What is the primary purpose of Route Groups named with parentheses, such as app/(auth)/login/page.tsx?
Question 4
Given the route app/tutorials/[...slug]/page.tsx, what will (await params).slug evaluate to when a user visits /tutorials/web/react/hooks?
Question 5
What happens if two different Route Groups define the same URL path (e.g. (marketing)/about/page.tsx and (admin)/about/page.tsx)?

Next Lesson

Streaming UI with loading.tsx and Suspense Boundaries

Continue learning with hands-on practice, examples, and exercises in the upcoming topic.

Related Lessons

Previous LessonNext Lesson
Core File Conventions: page.tsx, layout.tsx, template.tsx & not-found.tsxStreaming UI with loading.tsx and Suspense Boundaries

Practice Quiz

Test your understanding of this lesson with 5 questions. Each question has one correct answer.

Mentor-Led Practical Training

Master Next.js 15 with Hands-On Projects

Practice in live mentor-led sessions with real projects, mock tests, and verifiable certification at MSK Institute.

View Full CourseBook Free Demo
PreviousNext
PreviousPrevNext