React Native & Expo (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)
Offline-First State Synchronization: WatermelonDB vs MMKV vs SQLite with background syncing.
senior LevelDatabases & SQL
In Simple Words: Mobile apps frequently operate in subways or poor cell reception:
- MMKV (Tencent): In-memory mapped key-value store using C++
mmap. 30x faster thanAsyncStorage; ideal for user preferences, auth tokens, and session flags. - WatermelonDB: High-performance SQLite-backed reactive database:
- Lazy loading: loads only visible rows into memory.
- Observable queries: UI automatically re-renders when local database rows mutate.
- Built-in sync engine: Tracks
created_atandupdated_atcolumns to exchange compact JSON deltas with backend endpoints during network recovery.