A route group is a folder in the app directory that groups routes together without affecting the URL path. It helps organize routes without changing the visible URL structure.
Click to reveal answer
beginner
How do you create a route group in Next.js using (groupName)?
You create a folder with parentheses around the group name, like (groupName), inside the app directory. This folder groups routes but does not add the groupName to the URL path.
Click to reveal answer
intermediate
Why use route groups in Next.js instead of normal folders?
Route groups help keep your file structure clean and organized without changing the URL. This is useful when you want to group related pages but keep URLs simple and user-friendly.
Click to reveal answer
beginner
Example: What URL does the route /app/(admin)/dashboard render if dashboard.js is inside (admin)?
The URL will be /app/dashboard because the (admin) folder is a route group and does not add to the URL path.
Click to reveal answer
intermediate
Can route groups contain nested route groups in Next.js?
Yes, route groups can be nested inside other route groups to organize complex route structures without affecting the URL paths.
Click to reveal answer
What does a folder named (admin) inside the app directory do in Next.js?
AAdds 'admin' to the URL path
BGroups routes without changing the URL path
CCreates a new API route
DDeletes all routes inside it
✗ Incorrect
Folders with parentheses like (admin) group routes but do not add their name to the URL.
If you want to organize routes but keep URLs clean, what should you use?
ANormal folders without parentheses
BStatic files
CAPI routes
DRoute groups with (groupName)
✗ Incorrect
Route groups let you organize routes without changing the URL path.
Which of these is true about route groups in Next.js?
AThey do not affect the URL path
BThey are deprecated
CThey only work for API routes
DThey change the URL path to include the group name
✗ Incorrect
Route groups do not affect the URL path; they only organize files.
How do you name a folder to make it a route group?
AUse a dot before the folder name
BPrefix the folder name with an underscore
CWrap the folder name in parentheses, like (groupName)
DAdd a dash before the folder name
✗ Incorrect
Parentheses around the folder name create a route group.
Can route groups be nested inside each other?
AYes, nesting is allowed
BNo, nesting is not allowed
COnly one level of nesting is allowed
DOnly for API routes
✗ Incorrect
Route groups can be nested to organize complex routes.
Explain what route groups with (groupName) are in Next.js and why they are useful.
Think about how to organize routes without changing what users see in the URL.
You got /4 concepts.
Describe how you would structure folders using route groups to keep URLs simple but organize many related pages.
Focus on folder naming and URL impact.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of using route groups with (groupName) in Next.js?
easy
A. To organize routes in folders without changing the URL structure
B. To change the URL path to include the group name
C. To create dynamic routes with parameters
D. To add middleware to specific routes
Solution
Step 1: Understand route groups concept
Route groups use parentheses in folder names to group routes logically without affecting the URL path.
Step 2: Compare URL effect
Since the URL does not include the group name, the main purpose is organization, not URL change.
Final Answer:
To organize routes in folders without changing the URL structure -> Option A
Quick Check:
Route groups = organize without URL change [OK]
Hint: Parentheses folders group routes but keep URLs clean [OK]
Common Mistakes:
Thinking group name appears in URL
Confusing with dynamic route parameters
Assuming it adds middleware automatically
2. Which of the following folder names correctly creates a route group named admin in Next.js?
easy
A. admin
B. (admin)
C. [admin]
D. {admin}
Solution
Step 1: Identify route group syntax
Route groups use parentheses around the folder name, like (groupName).
Step 2: Match folder name
The folder named (admin) correctly creates a route group called admin.
Final Answer:
(admin) -> Option B
Quick Check:
Parentheses folder = route group [OK]
Hint: Use parentheses for route groups, not brackets or braces [OK]
Common Mistakes:
Using square brackets which are for dynamic routes
Using curly braces which are invalid
Omitting parentheses and creating normal folders
3. Given this folder structure in Next.js app router:
Folders with parentheses group routes but do not add to URL path.
Step 2: Map folder names to URLs
The (dashboard) group is invisible in URL, so app/(dashboard)/page.tsx maps to / because the page.tsx inside is the root of that group. Similarly, app/(dashboard)/settings/page.tsx maps to /settings. The app/profile/page.tsx maps to /profile.
Final Answer:
/, /settings, /profile -> Option D
Quick Check:
Route groups hide folder name but keep nested paths [OK]
Hint: Route groups hide folder name but keep nested routes [OK]
Common Mistakes:
Including parentheses folder name in URL
Ignoring nested folder names inside groups
Assuming root group maps to root URL
4. You created a folder named (admin) inside app but your routes under it are not working. What is the most likely mistake?
medium
A. You forgot to add a page.tsx file inside the (admin) folder
B. You used square brackets instead of parentheses for the folder name
C. You named the folder admin without parentheses
D. You placed the (admin) folder outside the app directory
Solution
Step 1: Check route group folder requirements
Route groups require a page.tsx or similar file inside to define the route component.
Step 2: Identify missing page file issue
If routes inside (admin) don't work, missing page.tsx is the most common cause.
Final Answer:
You forgot to add a page.tsx file inside the (admin) folder -> Option A
Quick Check:
Missing page.tsx = no route rendered [OK]
Hint: Always add page.tsx inside route group folders [OK]
Common Mistakes:
Confusing folder naming syntax
Placing folders outside app directory
Assuming route groups auto-create pages
5. You want to create two separate route groups (marketing) and (sales) inside app with pages home.tsx and contact.tsx each. How should you organize folders so URLs are /home and /contact without group names in URL?
hard
A. app/(marketing)/home.tsx and app/(sales)/contact/page.tsx
B. app/(marketing)/home.tsx and app/(marketing)/(sales)/contact.tsx
C. app/(marketing)/home.tsx and app/(sales)/contact.tsx
D. app/home.tsx and app/contact.tsx
Solution
Step 1: Use route groups to hide folder names
Folders named with parentheses group routes without adding to URL path.
Step 2: Place pages inside separate route groups
Placing home.tsx inside (marketing) and contact.tsx inside (sales) keeps URLs as /home and /contact.
Final Answer:
app/(marketing)/home.tsx and app/(sales)/contact.tsx -> Option C
Quick Check:
Separate groups hide folder names, URLs stay clean [OK]
Hint: Put pages inside separate parentheses folders for clean URLs [OK]
Common Mistakes:
Nesting groups causing longer URLs
Placing pages outside groups losing organization
Using page.tsx inconsistently inside groups
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.