How can I access local database on react native?

后端 未结 4 566
我寻月下人不归
我寻月下人不归 2020-12-13 18:08

We often access a local sqlite database when we developing an app. What is the counterpart in react native? Do I have to use AsyncStorage to store data without a native modu

相关标签:
4条回答
  • 2020-12-13 18:50

    Full feature SQLite Plugin for React Native is available here:

    https://github.com/andpor/react-native-sqlite-storage

    Version 2.1.0 supports both iOS and Android and the fmk has both plain JS callback and Promise based interfaces.

    0 讨论(0)
  • 2020-12-13 18:50

    Embedded persistent or in memory database for react-native https://github.com/smartdemocracy/react-native-local-mongodb

    It's have Performance statistics

    • Insert: 10,680 ops/s
    • Find: 43,290 ops/s
    • Update: 8,000 ops/s
    • Remove: 11,750 ops/s
    0 讨论(0)
  • 2020-12-13 18:51

    Updated answer: there's now a fledgling SQLite wrapper available:

    https://github.com/andpor/react-native-sqlite-storage

    Previously:

    This comment on Hacker News indicates that there's nothing available right now:

    There is currently no native module for SQLite, but you can build one if you want. :-D http://facebook.github.io/react-native/docs/nativemodulesios.html

    We use a key-value store for most of our client-side persistence: http://facebook.github.io/react-native/docs/asyncstorage.html

    It's by Eric Vicenti who seems to work at Facebook and contribute to React Native, so pretty authoritative.

    0 讨论(0)
  • 2020-12-13 19:05

    Realm React Native enables you to efficiently write your app’s model layer in a safe, persisted and fast way. Here’s what it looks like: See Realm React Native and Docs For Realm

    0 讨论(0)
提交回复
热议问题