3

im working on a react native app and i am going to need to store some data to local storage on the device. of course you have many packages out there to help with this, but it looks like the storage is done using a key-value pair.

i was wondering what is best practice for implementing some structured storage on a react-native app?

for example the things i was to save are:

- user settings
- app settings  
- photos taken by the user

what would be the best practice for storing these in a key-value based storage system.

if i wanted a folder-like structure, i could store as:

settings
--> user-settings.json
--> app-settings.json
photos
-->album1
---->photo1.jpg
---->photo2.jpg
-->album2
---->cat.jpg

i could have a key naming convention as "{folders}/{file}" for example the key could be called: 'photos/album1/photo1.jpg'. and the value can be a base64 encoding of the image; but with a string name like that in a large team, it may be difficult to maintain such a naming convention, because the key name can be any string.

so how are other people implementing complex local storage data structures?

X0r0N
  • 1,816
  • 6
  • 29
  • 50
  • 3
    I'd suggest `AsyncStorage` for your settings and something more comprehensive like `Realm` for your album data – sooper May 15 '17 at 22:48

0 Answers0