如何在 React Native 上访问本地数据库? [英] How can I access local database on react native?
问题描述
我们在开发应用程序时经常访问本地sqlite数据库.react native中的对应物是什么?我是否必须使用 AsyncStorage 在没有本机模块的情况下存储数据?
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 module?
推荐答案
更新答案:现在有一个初出茅庐的 SQLite 包装器可用:
Updated answer: there's now a fledgling SQLite wrapper available:
https://github.com/andpor/react-native-sqlite-storage
以前:
Hacker News 上的这条评论表明目前没有可用的信息:
This comment on Hacker News indicates that there's nothing available right now:
目前没有 SQLite 的原生模块,但你可以构建一个如果你想.:-Dhttp://facebook.github.io/react-native/docs/nativemodulesios.html
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
对于我们的大部分客户端持久性,我们使用键值存储:http://facebook.github.io/react-native/docs/asyncstorage.html
We use a key-value store for most of our client-side persistence: http://facebook.github.io/react-native/docs/asyncstorage.html
这是 Eric Vicenti 的作品,他似乎在 Facebook 工作并为 React Native 做出了贡献,非常权威.
It's by Eric Vicenti who seems to work at Facebook and contribute to React Native, so pretty authoritative.
这篇关于如何在 React Native 上访问本地数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!