Dynamic route

A route file with a bracketed segment, such as restaurant/[id].tsx, that serves every value of that segment. The screen reads it with useLocalSearchParams, and the value is always a string that you convert and validate yourself.

Minimal example

tsx
const { id } = useLocalSearchParams<{ id: string }>();
const restaurantId = Number(id);

Learn this concept

Lesson 4.2 · Expo Router navigation

Used in exercises

Exercise 4.11 · Restaurant menu screen Exercise 4.17 · Orders tab and order detail screens
Prerequisite conceptsExpo Router