sunnylqm / react-native-storage

local storage wrapper for both react-native and browser. Support size controlling, auto expiring, remote data auto syncing and getting batch data in one query.
MIT License
3.02k stars 268 forks source link

Initializing new storage #208

Closed hungngo97 closed 5 years ago

hungngo97 commented 5 years ago

I'm having trouble with reloading the data when I open the app again ( I did save the data before), but the data is lost after I restart the app. How should I set the storageBackend to prevent this? Thanks for great library.

// Use AsyncStorage for RN apps, or window.localStorage for web apps. // If storageBackend is not set, data will be lost after reload. storageBackend: AsyncStorage, // for web: window.localStorage

hungngo97 commented 5 years ago

In detail, I saved data during usage of the app and want that data to remain, but when I restart the app, the default data of autosync method keeps override my data.

sunnylqm commented 5 years ago

Post your code here

hungngovinh commented 5 years ago

Hey I am sorry for the late response :) apparently when I initializing the memory I accidentally put the memory removal at the end of the app file for testing so it gets deleted whenever my App is up. Thanks for the great library