Navigation

One screen apps are just sad websites.

▶ the lesson · narrated sketch video · tap for sound

the intro

Multi-screen apps need navigation: a stack that pushes and pops screens, tabs for top-level sections, and deep links that jump straight anywhere. React Navigation and Expo Router are the standard ways to build it.

fun fact ✦

Deep links are why tapping a notification can open the exact product page — not just the app.

the docs

the deep dive

the ideas behind the video — concepts, diagrams, a walkthrough and the traps to avoid

Web apps learned navigation from browsers: a URL per page, a back button, a history pile. Mobile has no URL bar, so navigation is just state — a tree of screens the library renders one at a time. Push adds to the pile, pop removes it, tabs switch between independent piles. Once you internalize that screens are data, deep links and auth flows stop feeling magical.

navigation is state, not pages

tab barHome stackSearch stackProfile stack
tabs for top-level sections, a stack inside each one — real apps nest both

key terms

stack

Screens piled on top of each other. Push adds, pop removes, and the back gesture is a pop.

Feed → Post → back

route params

The payload you attach when navigating to a screen — an id, a query, a flag.

navigate('Post', { id: 42 })

tab navigator

Parallel top-level sections, each keeping its own stack and scroll position.

Home | Search | Profile

deep link

A URL scheme that maps a path straight to a screen, no home-screen detour.

myapp://product/42

how it works

  1. 1
    Wrap the app

    NavigationContainer hosts the navigation state; inside it you place your root navigator.

  2. 2
    Declare a stack

    List your screens once with Stack.Screen. Each gets a name and a component.

  3. 3
    Navigate with params

    navigation.navigate moves between screens, carrying data in route.params.

  4. 4
    Nest tabs around stacks

    Each tab owns a stack, so Home can be three screens deep while Search sits at its root.

  5. 5
    Wire deep links

    Register a scheme and a path-to-screen mapping so notifications land on the exact screen.

the code, explained

a screen that reads its params, and the push that feeds it

1function Post({ route }) {
2 // data arrives with the push
3 const { id } = route.params
the payload that came with the push
4 return <Text>Post number {id}</Text>
5}
6
7// anywhere in the app:
8navigation.navigate('Post', { id: 42 })
pushes Post onto the stack, carrying data

side by side

React Navigation

  • compose navigators in code
  • works with or without Expo
  • you wire deep links by hand
  • maximum control, more boilerplate
VS

Expo Router

  • the file system is the route map
  • typed links + deep links built in
  • conventions over config
  • Expo projects only
🪤 gotcha

Popping a screen unmounts it — scroll position, typed text, unsent forms, all gone. Android's hardware back button is a pop too, so this bites Android users first. Keep state that matters in params, context, or storage, and prefer navigate() over push() to return to an existing screen instead of stacking a duplicate.

quick answers

Stack or tabs first?

Tabs for sections the user switches between all day; stack for drilling into detail. Real apps nest both — each tab contains a stack.

Why did my screen lose its state?

It unmounted when popped, or its parent re-rendered. React Navigation keeps tab state by default — look for remounts caused by inline component definitions or changing keys.

React Navigation or Expo Router?

Same engine underneath. Expo Router adds file-based routes and typed links on top — great inside Expo; plain React Navigation works anywhere.

quick hits about Navigation

short answers · interviews, tips, trivia & hidden gems

🎤 interview

Stack or tabs?watch ↗

📚 tutorial

The navigator typeswatch ↗

🔧 useful

Screens by login state?watch ↗

💎 deep

URL → screenwatch ↗

🆕 update

Expo Routerwatch ↗