4 ms·
You probably don't need Redux if it's just simple persistence of data. The simplest option is just to read and write a blob of JSON using the AsyncStorage API:
by mambodog 9y ago
You probably don't need Redux if it's just simple persistence of data.
The simplest option is just to read and write a blob of JSON using the AsyncStorage API: https://facebook.github.io/react-native/docs/asyncstorage.html https://facebook.github.io/react-native/docs/asyncstorage.ht...
Another option you could try is Realm, which is commercial but has a free tier (even for commercial apps) and has a pretty simple API: https://news.realm.io/news/introducing-realm-react-native/ https://news.realm.io/news/introducing-realm-react-native/
Another is the SQLite module which comes with Expo:
Docs: https://docs.expo.io/versions/v16.0.0/sdk/sqlite.html https://docs.expo.io/versions/v16.0.0/sdk/sqlite.html
Example: https://github.com/expo/sqlite-example/blob/master/main.js https://github.com/expo/sqlite-example/blob/master/main.js
- saurabh 9y agoHighly recommend realm, works like a charm and has migrations too.
- cableshaft 9y agoI'm sure it works great, but I dislike adding too many layers to my apps. I've been burned too many times by companies that have stopped supporting and moved on to something else, or disappeared, or haven't kept up with the latest iOS changes, or whatever, and I'm forced to migrate to a different solution, to let myself use these for my personal projects, where I have very limited time and energy. Even using React Native is more than I'd normally do, but I don't see a better cross-platform option right now.
- cableshaft 9y agoOkay cool. Good to know that you don't need to use Redux in conjunction with AsyncStorage. I also like SQLite, so I'll investigate that as well. It'd be really nice if I get away without Redux. It was the main pain point I had with it, everything else was fairly smooth.