What You’ll Build
A multi-screen app with:- Home screen
- Profile screen
- Settings screen
- Tab navigation between screens
- Dynamic routes for user profiles
Prerequisites
Complete the Create Your First Project tutorial first.
Understanding File-Based Routing
Expo Router uses your file structure to create routes automatically. Files in theapp/ directory become screens:
No route configuration needed - just create files and they become routes!
Step 1: Create Additional Screens
Let’s add two new screens to your app.Create Profile Screen
Createapp/profile.tsx:
app/profile.tsx
Create Settings Screen
Createapp/settings.tsx:
app/settings.tsx
Step 2: Add Navigation Links
Update your home screen to link to the new screens:app/index.tsx
Save and test! Tap the buttons to navigate between screens.
Step 3: Add Tab Navigation
Let’s create a tab bar at the bottom of the app.Create Tabs Group
Create a new folder and layout:app/(tabs)/_layout.tsx:
app/(tabs)/_layout.tsx
The
(tabs) folder name uses parentheses to create a route group that doesn’t affect the URL path.Move Screens to Tabs
Move your screens into the tabs group:app/_layout.tsx:
app/_layout.tsx
Now you have a tab bar at the bottom! Try switching between tabs.
Step 4: Add Dynamic Routes
Dynamic routes let you create pages based on parameters (like user IDs). Createapp/(tabs)/profile/[id].tsx:
app/(tabs)/profile/[id].tsx:
app/(tabs)/profile/[id].tsx
app/(tabs)/profile/index.tsx to link to dynamic routes:
app/(tabs)/profile/index.tsx
Tap on a user to navigate to their dynamic profile page!
Navigation Methods
Expo Router provides multiple ways to navigate:Using Link Component
Using router Object
Programmatic Navigation
Advanced Routing Patterns
Modal Routes
Create a modal by adding it to the root stack:app/_layout.tsx
Nested Navigators
Create complex hierarchies:Catch-All Routes
Handle 404s with+not-found.tsx:
app/+not-found.tsx
Type-Safe Routes
Expo Router generates types for all your routes:Navigation Best Practices
Use descriptive file names
Use descriptive file names
File names become routes, so make them clear:
Deep link friendly URLs
Deep link friendly URLs
Design URLs that work as deep links:
Troubleshooting
Screen not appearing
Screen not appearing
Check:
- File is in
app/directory - File exports a default component
- Dev server restarted after adding file
Dynamic route params undefined
Dynamic route params undefined
Use
useLocalSearchParams correctly:Next Steps
Congratulations! You’ve learned:- File-based routing basics
- Creating multiple screens
- Tab navigation
- Dynamic routes
- Navigation methods
- Best practices
Build & Deploy
Ship your app to production
Router Documentation
Advanced routing features
SDK Modules
Add more features to your app
Core Concepts
Understand Expo architecture