モバイルアプリはしばしばオフライン(接続がないまたは不安定)で動作する必要があり、接続が戻ったときにデータを同期する必要があります。これには、ローカルデータストレージ、接続検出、変更のキューイング、同期が含まれます。これは堅牢なモバイルアプリの重要だが困難な側面です。
なぜ重要なのか
Mobile devices have UNRELIABLE connectivity (no signal, poor network, airplane mode):
→ apps that break/are useless offline frustrate users
→ OFFLINE-FIRST apps work regardless of connectivity → better, more robust UX
→ Handle: reading cached data offline, making changes offline, syncing when back online.
オフラインサポートの主要要素
✓ LOCAL STORAGE — cache data locally (SQLite, WatermelonDB, AsyncStorage/MMKV) so the
app works with local data offline
✓ DETECT CONNECTIVITY — @react-native-community/netinfo (online/offline status)
✓ OFFLINE WRITES — let users make changes offline; QUEUE them locally
✓ SYNC — when back online, send queued changes to the server; pull server updates
✓ Show appropriate UI (offline indicator, pending/syncing status)
