0
0
Svelteframework~20 mins

Route groups in Svelte - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Route Groups Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
component_behavior
intermediate
1:30remaining
How does a route group affect URL paths in SvelteKit?

Consider a SvelteKit app with a route group folder named (admin) containing a page dashboard.svelte. What URL path will render this page?

Svelte
src/routes/(admin)/dashboard.svelte
A/dashboard
B/admin/dashboard
C/(admin)/dashboard
D/dashboard/(admin)
Attempts:
2 left
💡 Hint

Route groups in parentheses do not add to the URL path.

📝 Syntax
intermediate
1:30remaining
Identify the invalid route group folder name

Which folder name is NOT valid for a route group in SvelteKit?

A[group]
B(user-settings)
C(profile)
D(dashboard)
Attempts:
2 left
💡 Hint

Route groups must be wrapped in parentheses, not square brackets.

state_output
advanced
2:00remaining
What is the rendered output path for nested route groups?

Given this folder structure in SvelteKit:

src/routes/(app)/(dashboard)/stats.svelte

What URL path will render stats.svelte?

A/stats/(app)/(dashboard)
B/app/dashboard/stats
C/(app)/(dashboard)/stats
D/stats
Attempts:
2 left
💡 Hint

Route groups do not add segments to the URL path, even when nested.

🔧 Debug
advanced
2:00remaining
Why does this route group cause a 404 error?

In a SvelteKit app, a developer creates a folder named (admin-panel) with a page index.svelte. The URL /admin-panel returns 404. Why?

Svelte
src/routes/(admin-panel)/+page.svelte
AThe file must be named 'admin-panel.svelte' to match the URL.
BRoute groups do not add to the URL, so '/admin-panel' does not match any route.
CThe folder name must not contain a hyphen inside parentheses.
DRoute groups require a +page.svelte file, not index.svelte.
Attempts:
2 left
💡 Hint

Think about how route groups affect URL paths.

🧠 Conceptual
expert
2:30remaining
What is the main purpose of route groups in SvelteKit?

Why would a developer use route groups (folders with parentheses) in a SvelteKit project?

ATo automatically generate nested layouts for each group.
BTo create dynamic URL segments for parameters.
CTo organize routes without changing the URL structure.
DTo enable server-side rendering only for grouped routes.
Attempts:
2 left
💡 Hint

Consider how route groups affect URLs and project structure.