Skip to main content

Route Groups

Route groups allow you to organize your files and apply layouts without affecting the URL structure. They’re created using parentheses (group) in folder names.

What Are Route Groups?

Route groups are folders wrapped in parentheses that:
  • Don’t appear in URLs - (auth)/login.tsx becomes /login, not /(auth)/login
  • Organize files logically - Group related routes together
  • Apply different layouts - Each group can have its own _layout.tsx
  • Share settings - Configure navigation per group

Creating Route Groups

Wrap a folder name in parentheses:
Both (auth) and (app) are invisible in URLs.

Basic Example

Without Route Groups

URLs include auth/ prefix.

With Route Groups

URLs are clean, no (auth) prefix.

Multiple Layouts

Use groups to apply different layouts to different sections:

Root Layout

app/_layout.tsx

Auth Layout

app/(auth)/_layout.tsx

Tabs Layout

app/(tabs)/_layout.tsx

Array Syntax

Share layouts across multiple groups using array syntax:
This is equivalent to:
From CLAUDE.md:210-212:

Array Syntax Example

app/(shop,cart,checkout)/_layout.tsx
Applies to:
  • (shop)/ routes
  • (cart)/ routes
  • (checkout)/ routes

Organizing by Feature

Group routes by feature or domain:

Nested Route Groups

Groups can be nested:
app/(app)/_layout.tsx

Initial Route Configuration

Set different initial routes per group:
app/(tabs)/_layout.tsx
From test file (navigation.test.ios.tsx:21-40):

Common Patterns

Authentication Flow

Separate authenticated and unauthenticated routes:
app/_layout.tsx

Platform-Specific Groups

Different layouts for mobile and web:
app/(mobile)/_layout.tsx

Multi-Tenant Apps

Different sections for different user types:

E-commerce Flow

Dashboard with Sections

Best Practices

Use Descriptive Names

Keep Groups Focused

Match Navigation Structure

Use Array Syntax Carefully

Only use array syntax when layouts are truly identical:

Debugging Route Groups

Check Segments

Use useSegments() to see active groups:

View Route Structure

Visit /_sitemap in development to see all routes:

Common Issues

URLs include group names:
Layout not applying:

Limitations

Cannot Have Same Route in Multiple Groups

Expo Router will show a warning and use the first route.

Groups Don’t Affect Deep Linking

Deep links use the final URL:

Advanced Patterns

Conditional Group Rendering

app/_layout.tsx

Group-Specific Context

app/(dashboard)/_layout.tsx

Shared Components Per Group

app/(admin)/_layout.tsx

Next Steps

Layouts

Learn more about layouts

File-Based Routing

Understand routing conventions

Stack Navigation

Configure stack navigation

Tab Navigation

Create tab navigation