Expo Router

Also called File-based routing

Updated

What is Expo Router in React Native?

Expo Router is a file-based routing library for React Native. Files in the app directory become routes, with deep links and typed navigation derived automatically.

_layout.tsxindex.tsx/settings.tsx/settings[id].tsx/post/[id]post//Home/
The file the URL matchedA file in app/Unmatched routeIn Expo Router the app/ folder is the navigation: index.tsx is /, settings.tsx is /settings, post/[id].tsx matches /post/42 with id = 42, and _layout.tsx wraps every route. Because every screen has a URL, a push notification or shared link opens it with no extra wiring, and adding a file adds a route. It is built on React Navigation's navigators, with routes taken from the filesystem instead of a config object.

Expo Router brings file-based routing to React Native. The layout of your app/ directory is the navigation structure, the same convention Next.js uses on the web.

app/
  _layout.tsx      → wraps every route
  index.tsx        → /
  settings.tsx     → /settings
  post/[id].tsx    → /post/42

It is built on React Navigation rather than replacing it, so the underlying navigators — stack, tabs, drawer — are the same ones. What Expo Router adds is convention: routes come from the filesystem instead of a hand-maintained config object.

Three things newcomers get for free:

  • Deep linking. Every screen has a URL, so a push notification or a shared link can open it with no extra wiring.
  • Typed routes. href values are checked against the routes that actually exist.
  • Web support. The same tree renders as a real website through React Native Web.

See the Expo Router docs.