3

I have a pretty huge amount of data with multiple nesting coming from the server for my react-native app. The problem with using async storage is, each time i want to modify the data, it has to do JSON.stringify and JSON.parse and persist and get the data which is taking a pretty huge amount of time.

Can I store objects in Realm or Firebase without having to stringify them? I have gone through this. Does firebase store JSON objects as is or is it stringifying them behind the scenes? Which DB in react-native supports storing of Objects?

illiteratewriter
  • 4,155
  • 1
  • 23
  • 44
  • If you are using redux, then you can use redux-persist. It is very handy, no need for any other library. And if you are not using redux, you can go for realm as with realm, you can directly store objects and even query with those objects. – Sarmad Shah Jan 09 '19 at 06:57
  • [react-native-simple-store](https://www.npmjs.com/package/react-native-simple-store) is a library. I have not used this. You can take a look at this one also – Madhavan.V Jan 09 '19 at 06:59
  • @Sarmad `redux-persist` is also stringifying data behind the scenes. – illiteratewriter Jan 09 '19 at 07:01
  • @Madhavan.V react-native-simple-store is just a wrapper for AsyncStorage so there's no difference in terms of stringifying the data – sigabrt Jan 09 '19 at 13:02
  • 1
    @illiteratewriter having your objects passed between whichever storage you work with and React Native will always require some sort of serialization since you're passing data between your native app and the JS context. Have you considered using AsyncStorage `mergeItem` to reduce the amount of data that needs to be sent for subsequent updates? – sigabrt Jan 09 '19 at 13:20

0 Answers0