React Native interview question · Most asked
Where should you store data on the device, and what should never go in AsyncStorage?
Summary
AsyncStorage for small, non-sensitive key-value data; SQLite for structured data you query; the file system for files; and secure storage (Keychain/Keystore via expo-secure-store) for tokens and secrets, which must never go in AsyncStorage because it isn't encrypted.
Longer Answer
AsyncStorage stores plain strings and rewrites whole values, so it suits settings and small caches. For hundreds or thousands of records with filtering and sorting, use expo-sqlite. Store large binary data as files and keep only paths in the database.
Key Points
- AsyncStorage: small, non-sensitive.
- SQLite: queryable data.
- SecureStore: tokens and secrets.
- Files for blobs.
Deep dive: Mobile Apps with React Native and Expo: Working Offline
Explanation
What interviewers look for
Clear separation of sensitive vs non-sensitive storage, and matching the store to the data shape.
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?
- How would you make a React Native app work offline?
- 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?