How React Native runs your app · mid
App lifecycle, AppState and process death
AppState tells JS whether the app is active, inactive (iOS only) or in the background, and because the OS can kill a backgrounded app at any time without running any of your JS, anything the user would hate to lose must be saved while the app is still running.
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceThe notes
What you must know
- AppState values: active, background, and inactive (iOS only: app switcher, Notification Center, incoming call). Events: "change", "memoryWarning" (iOS), "focus" and "blur" (Android).
- Process death: Android (and iOS under memory pressure) can kill a backgrounded app. No JS runs at that moment, so useEffect cleanup does not run.
- So save drafts while the user types (debounced) or when AppState changes to background, into MMKV or SQLite. Restore on the next launch. Never put secrets in plain storage.
- Test process death with the Android developer option "Don't keep activities", or adb shell am kill <package> while the app is in the background.
- On resume: check token expiry, refetch stale data (TanStack Query focusManager), reconnect sockets.
- The iOS 27 SDK requires the UIScene lifecycle. RN 0.88 added SceneDelegate support; Expo SDK 58 prebuild generates SceneDelegate.swift.
The red pen
Common traps: mistake → fix
Mistake: "Save the form in useEffect cleanup"
Fix: cleanup does not run when the OS kills the process.
Mistake: "inactive also happens on Android"
Fix: inactive is iOS-only.
Mistake: "Background means my JS keeps running"
Fix: the app may be suspended or killed at any moment.
Easy to hard
Questions interviewers ask, easy to hard
- Which AppState values exist? Which one is iOS-only?
- A user switches apps to copy an OTP and comes back to an empty form. What happened?
- What do you persist, where, and when?
- How do you test process death?
- What changes with SceneDelegate in RN 0.88?
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceYour first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.