8

I’m working on a react native app where I have my firebase database storing an inventory of about 10000 items. So I need to store that data locally and I was thinking of saving each item into his own key with async storage. Is that okay or is there a more efficient way?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Facundo Silva
  • 111
  • 1
  • 6
  • 2
    Note that on Android AsyncStorage has an upper size limit of 6MB. – Andrew Apr 05 '19 at 06:54
  • 1
    The previous comment is true, but this limit can be changed by adding an `AsyncStorage_db_size_in_MB` property to `android/gradle.properties` and set the value to the new max MB. – pseudoku Jul 18 '21 at 01:29

2 Answers2

5

AsyncStorage has slow runtime and has no indexing capabilities. Because AsyncStorage only accepts string as its value, all data must first be serialized into string before being inserted, and deserialized once retrieved. This is why you should not use AsyncStorage when dealing with a large amount of data

you can read this article for more information on how AsyncStorage works while dealing with large data: https://codeburst.io/tackling-react-native-storage-part-1-d27b2bfa480f

Ankush Rishi
  • 2,861
  • 8
  • 27
  • 59
2

You can use AsyncStorage, it will always take a time when you try to retrieve the data from it.

There are other possible way like:

1) React Native SQLite 2

2) React Native Storage

3) Realm

4) React Native Local MongoDB

Nirmalsinh Rathod
  • 5,079
  • 4
  • 26
  • 56