React Navigation Lifecycle: Screens Don't Unmount

Unlike the web, React Native screens don't unmount when you navigate away; they stay mounted to preserve state. This means a standard `useEffect` only runs once. To run code when a screen is shown, you must listen for the `focus` event.
Don't expect React Native screens to unmount like web pages. When you navigate away, screens stay mounted in the background to preserve their state, like scroll position or form data. This means a standard `useEffect` hook fires only once when the screen first mounts, not every time the user returns. The footgun is assuming React's lifecycle is enough; you must use `focus` and `blur` events to run code when a screen becomes visible or is hidden.
Read the original → reactnavigation.org
- #react native
- #react navigation
- #mobile
- #lifecycle
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.