SyncStorage wraps React Native's asynchronous AsyncStorage to provide a synchronous API for reading and writing key-value pairs. Version 0.4.2 (stable, less frequent releases) loads all stored data into memory on init, enabling synchronous get/set/remove operations thereafter. It supports any value type (via JSON serialization) and returns promises for post-verification. Unlike raw AsyncStorage which requires async/await, SyncStorage simplifies simple data access in synchronous contexts but requires careful memory management for large datasets.
npm install sync-storageNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates initializing SyncStorage, then using synchronous get/set/remove/getAllKeys with various data types.
Call await SyncStorage.init() at app startup before any SyncStorage usage.
Avoid storing large amounts of data with SyncStorage; use AsyncStorage directly for large data.
Use await SyncStorage.remove(key) or .then() to ensure removal completes.
Call init() exactly once during app lifecycle.
Ensure import SyncStorage from 'sync-storage'; is correct.
Use import SyncStorage from 'sync-storage'; (no curly braces).
Install @react-native-async-storage/async-storage and link for React Native <0.60.
Add await before SyncStorage.init().