I am working on a mobile app with react native and expo. The critical point of the app is that it needs to store big data on a device because it will work in offline and online modes both. I'm thinking to try expo SQLite for this and I have few questions regarding this:
Thanks in advance!
Redux-persist and SQLite are not ideal ways to store large data on mobile devices. You can store your data on the application storage managed by the relevant OS. You can use Documents or /Library/Caches or tmp directories on iOS and external storage or external sd card on Android. You will need read-write permissions on Android, you can use react-native-permissions to handle it. react-native-fs is a good library to save, read or delete files.
If you store a binary or text in your database when you delete that record, it will reduce your database size. But if you store your file in the documents folder and add a reference to your database, deleting this reference won't remove the actual file from the device. You need to do this yourself.
I assume you are storing binaries. Regardless of the data type, there is a limit for SQLite Text type which is 2 GB. You can see more info here
I would prefer storing data in local storage as explained above and keep the references in Async Storage managed by redux-persist or a local SQLite database.
I just use expo-file-system as all my data is stored in a single tree so it's easy to async write it to file after every update and load it when the app opens.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With