DEV Community

Alex Spinov
Alex Spinov

Posted on

Expo Router Has a Free API That Most Developers Dont Know About

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
Enter fullscreen mode Exit fullscreen mode

Dynamic Routes

import { useLocalSearchParams } from "expo-router";

export default function Post() {
  const { id } = useLocalSearchParams<{ id: string }>();
  return <Text>Post: {id}</Text>;
}
Enter fullscreen mode Exit fullscreen mode

Navigation

import { Link, router } from "expo-router";
<Link href="/posts/123">View</Link>
router.push("/posts/123");
Enter fullscreen mode Exit fullscreen mode

API Routes

// app/api/hello+api.ts
export function GET() {
  return Response.json({ message: "Hello" });
}
Enter fullscreen mode Exit fullscreen mode

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)