Expo Router brings file-based routing to React Native with deep linking, typed routes, and universal app support.
File-Based Routes
app/
index.tsx # /
about.tsx # /about
posts/[id].tsx # /posts/123
Dynamic Routes
import { useLocalSearchParams } from "expo-router";
export default function Post() {
const { id } = useLocalSearchParams<{ id: string }>();
return <Text>Post: {id}</Text>;
}
Navigation
import { Link, router } from "expo-router";
<Link href="/posts/123">View</Link>
router.push("/posts/123");
API Routes
// app/api/hello+api.ts
export function GET() {
return Response.json({ message: "Hello" });
}
Key Features
- File-based routing for React Native
- Universal (iOS, Android, Web)
- Type-safe navigation
- API routes for server logic
Need to scrape or monitor web data at scale? Check out my web scraping actors on Apify or email spinov001@gmail.com for custom solutions.
Top comments (0)