David Ewins
Error library

Expo Router: find() returns undefined for a dynamic route id

ExpoConfirmed fix

Expo SDK 57, expo-router 57.0.24

There is no error message for this one, only the symptom in the title.

Cause

Everything from the URL is a string. e.id === id compares the number 1 with the string "1" and fails.

Fix

Convert before comparing:

TSX
const exercise = exercises.find((e) => e.id === Number(id));

More Expo errors

Search all errors