DEV Community

Andreas Bergström
Andreas Bergström

Posted on • Edited on • Originally published at andreasbergstrom.dev

How to set the initial route in Expo Router

When an Expo Router app boots, it picks the first route alphabetically by default — which is rarely what you want once /login, /onboarding, and /home all live in the same directory. The fix is the initialRouteName prop on the Slot (or Stack) component, which tells the router which screen to mount first regardless of file order.

The full post shows the one-line change in practice, wrapped in a QueryClientProvider, and explains how Expo Router builds on React Navigation under the hood — so the same mental model carries over once you outgrow the file-based defaults.


Originally published at andreasbergstrom.dev — read the full post there.

Top comments (0)