Suggest an editImprove this articleRefine the answer for “What are route segments in Next JS?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)In **Next.js**, **route segments** are **parts of the URL** that correspond to **folders in** `app/` and form the page's path. **Key point:** segments can be static, dynamic, catch-all, or structural, and are used to form the URL, layouts, and rendering logic.Shown above the full answer for quick recall.Answer (EN)ImageIn **Next.js**, **route segments** are **parts of the URL** that correspond to **folders in** `app/` and form the page's path. In short: > **Each folder = one URL segment** --- ## Basic concept URL: ```txt /products/shoes/nike ``` Segments: ```txt products → shoes → nike ``` Their source: ```txt app/products/shoes/nike/page.tsx ``` --- ## Types of route segments ### 1. Static segments Regular folders: ```txt app/about/page.tsx → /about ``` - always the same URL - the simplest type --- ### 2. Dynamic segments Folders in square brackets: ```txt app/blog/[slug]/page.tsx → /blog/my-post ``` - `[slug]` - a route parameter - values come from the URL --- ### 3. Catch-all segments Catch several segments: ```txt app/docs/[...slug]/page.tsx ``` URL: - `/docs/a` - `/docs/a/b/c` --- ### 4. Optional catch-all segments Segments may be absent: ```txt app/docs/[[...slug]]/page.tsx ``` URL: - `/docs` - `/docs/react` - `/docs/react/hooks` --- ### 5. Route Groups (not URL segments) Folders in parentheses: ```txt app/(auth)/login/page.tsx → /login ``` - **do not form a URL segment** - used only for project structure --- ### 6. Parallel segments Named slots for UI: ```txt app/dashboard/@stats/page.tsx ``` - `@stats` - a UI segment, not a URL one - used for complex layouts --- ## How segments are used inside Next.js ### Passing parameters ```ts export default function Page({ params }) { // params.slug } ``` --- ### Managing layouts - every segment can have its own `layout.tsx` - a layout is inherited down the tree --- ### Cache and rendering - a segment = a cache boundary - Next.js can update parts of the page independently --- ## Common errors - confusing route groups with URL - expecting a route without `page.tsx` - using catch-all incorrectly --- ## Short interview answer > **Route segments in Next.js are parts of the URL that correspond to folders in** `app/`**. They can be static, dynamic, catch-all, or structural, and are used to form the URL, layouts, and rendering logic.**For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.