Websites · Glossary
What is Expo Router?
Expo Router is the file based router for Expo and React Native apps. Each file in the app directory becomes a screen with its own URL, layout files decide whether a folder shows as a stack or a tab bar, and the same routes work on iPhone, Android and the web, so links and deep links reach screens without extra setup.
Expo Router brings the way websites route pages to phone apps. Instead of registering screens by hand, you add a file, and the router turns its path into a screen and a link.
Nuwan Madhusanka · Co-founder
4 min read · Published
| File | Route | What it is |
|---|---|---|
| app/_layout.tsx | (wraps everything) | The root layout: fonts, theme and the outer stack |
| app/(tabs)/_layout.tsx | (wraps the tab screens) | Declares a tab bar for the screens in the (tabs) group |
| app/(tabs)/index.tsx | / | The first tab, usually Home |
| app/(tabs)/account.tsx | /account | Another tab; the group name does not appear in the URL |
| app/classes/[id].tsx | /classes/42 | A dynamic screen reading id from the URL |
| app/+not-found.tsx | any unknown path | The screen shown for a link that matches nothing |
What it is
Expo Router is a library from the Expo team built on top of React Navigation. It follows the file based routing idea popular in web frameworks: the folder structure under app is the navigation structure of the app. Every screen is automatically addressable by a URL, which means a link in an email, a notification or another app can open a specific screen. Expo's documentation describes it as working across Android, iOS and the web from one codebase.
How it works
Files become routes; folders become segments of the URL. A file named _layout.tsx wraps the routes beside it and chooses how they are shown, commonly as a Stack, where screens slide over each other, or as Tabs, where a tab bar switches between them. A folder whose name is in parentheses, such as (tabs), is a route group: it organises files without adding to the URL. Square brackets make a dynamic segment, so classes/[id].tsx serves every class page. Navigation uses a Link component or a router object, much like links on a website.
When it matters
Expo Router matters to anyone building a new Expo app, because it is the default in Expo's project templates and handles links for free. It matters for business apps that are reached from outside: a booking confirmation email with a link to the booking, a QR code on a counter that opens the menu, or a website button that opens the same screen in the installed app. And it matters when an app and a website share code, since routes look the same on both.
Common mistakes
Putting screens in the wrong group so they appear as unexpected tabs. Forgetting that every file in app becomes a route, including helper components saved there by mistake. Naming two files that resolve to the same URL. Hiding a screen from the tab bar but leaving it reachable by URL without checking sign in. Passing large objects in URL parameters instead of an id. And assuming a deep link works on a real phone without setting up the app's scheme and, for https links, universal links and app links.
Where it shows up in OneCraft
Phone apps built with OneCraft are Expo projects using Expo Router, React Native Reusables and Uniwind, each in its own repository. A generated app has up to 14 screens and 3 to 5 tabs ending with an Account tab, where people choose Light, Dark or Follow device appearance, find a notifications switch, sign in or out when the app has a database, and read About. Every tab is checked at 390 and 768 pixels wide and Home in dark mode. The project downloads as a zip with app.json filled.
Questions people ask
Is Expo Router the same as React Navigation?
Expo Router is built on React Navigation and uses its navigators underneath, such as stacks and tabs. The difference is how screens are declared: React Navigation registers them in code, while Expo Router derives them from files. Many React Navigation options still apply inside Expo Router layouts.
Do I need Expo Router to use Expo?
No. Expo apps can use React Navigation directly or another routing library. Expo Router is the default in new Expo templates and adds automatic deep links and web support for free, which is why most new Expo apps start with it and why most current Expo guides assume it.
Can Expo Router build a website too?
Yes. The same routes can be exported for the web, so app/about.tsx becomes an /about page. Screens written with React Native components render in the browser through React Native for Web. Web output suits companion sites and previews, though a dedicated web framework may suit a content heavy site better.
How do tabs work in Expo Router?
Put the tab screens in a group folder, often (tabs), and add a _layout.tsx there that returns the Tabs navigator with a title and icon for each screen. Each file in the group becomes one tab. Screens outside the group, such as a detail page, open over the tabs in a stack.
What is a route group?
A folder whose name is wrapped in parentheses, such as (tabs) or (auth). It groups screens so they can share a layout without adding the folder name to the URL. For example, app/(tabs)/settings.tsx is reached at /settings, not at /(tabs)/settings, so links stay short and readable.
Make one with websites
The button opens the generator with this use case already described. Change the wording to match your own.
Create a website with OneCraftRelated questions
- What is a tab bar?What is a tab bar? The row of top level destinations at the bottom of a phone app: Apple and Material guidance, how many tabs to use and what to avoid.
- Deep link vs universal linkDeep link vs universal link: custom scheme links against verified https links that open an app on iPhone and Android, with what happens without the app.
- What is Expo for React Native?What is Expo? An open source framework and set of services for building iPhone, Android and web apps with React Native from one codebase. How it fits together.
- What is a splash screen?What is a splash screen? The screen an app shows while it starts. iPhone launch screens, the Android 12 splash screen API and Expo's splash settings compared.
Written and checked by the OneCraft team. Last checked .