Introduction to Expo Router
Expo Router is a file-based routing library for React Native and web applications. Built on top of React Navigation, it provides automatic route generation from file structure, deep linking, typed routes, and cross-platform navigation.What is Expo Router?
Expo Router brings the simplicity of file-based routing to React Native, similar to what Next.js provides for web applications. Instead of manually configuring routes and navigation stacks, you simply create files in yourapp directory, and Expo Router automatically generates the navigation structure.
Key Features
File-Based Routing
Routes are automatically generated from your file structure. Create a file, get a route:Universal Navigation
Works seamlessly across iOS, Android, and web with a single codebase. Deep links, URL parameters, and navigation work identically on all platforms.Type-Safe Routes
Automatic TypeScript generation ensures type safety for all your routes and parameters:Deep Linking Built-In
Every route is automatically deep linkable. No additional configuration needed:Nested Layouts
Share UI across routes with nested layouts:app/_layout.tsx
Benefits Over Traditional Navigation
Simplified Setup
Traditional React Navigation:Automatic Deep Linking
Traditional: Requires manual linking configuration with path patterns and parameter parsing. Expo Router: Every route is automatically deep linkable with the correct URL structure.Type Safety
Traditional: String-based navigation with no type checking. Expo Router: Full TypeScript support with auto-generated types for routes and parameters.Quick Example
Create a simple app with navigation:app/index.tsx
app/about.tsx
app/profile/[id].tsx
Architecture Overview
Expo Router processes your file structure through a pipeline:- Metro
require.context()collects route files at build time getRoutes()converts file paths to aRouteNodetreegetReactNavigationConfig()generates React Navigation configurationgetLinkingConfig()creates deep linking configuration- NavigationContainer receives the final configuration
Next Steps
Installation
Install Expo Router and required dependencies
Quick Start
Build your first app with Expo Router
File-Based Routing
Learn how file structure maps to routes
Navigation
Navigate between screens