React Native interview question · Most asked
How would you make a React Native app work offline?
Summary
Read from a local store first, write changes locally and optimistically, queue them in a persisted outbox with client-generated IDs, and sync when connectivity returns; the server deduplicates by those IDs.
Longer Answer
Listen for connectivity (NetInfo) and app start to flush the outbox. Remove an operation only after the server confirms it. Define a conflict policy (last write wins by timestamp, field-level merge, or prompting the user). Show sync status in the UI. Cache server reads (e.g. TanStack Query with persistence) so screens render without the network.
Key Points
- Local-first reads and writes.
- Persisted outbox + idempotent client IDs.
- Remove only after confirmation.
- Explicit conflict policy and visible sync state.
Deep dive: Mobile Apps with React Native and Expo: Working Offline
Explanation
What interviewers look for
Idempotency, durability across restarts, and conflict handling, not just 'cache the API'.
Follow-up questions
- How do you handle two devices editing the same record?
- What if the server rejects a queued change?
More most-asked React Native questions
- What is React Native, and how does it differ from a hybrid (WebView) app?
- Explain the React Native threading model.
- What is the React Native New Architecture?
- When would you use FlatList instead of ScrollView, and how do you make long lists fast?
- Where should you store data on the device, and what should never go in AsyncStorage?
- How do you handle authentication tokens in a mobile app?
- A screen in your React Native app is slow. How do you investigate and fix it?
- What can be shipped with an over-the-air (OTA) update, and what can't?