如何在离线反应本机应用程序中存储长文本?
我正在使用 React Native 构建一个教程应用程序。我设计得很好,但我不知道如何存储它的数据。
我认为像这样存储在对象中......
Tutorial = [
{
Intro : {
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incid quis.."
},
content : {
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do sunt in culpa qui officia deserunt mollit anim id est laborum...
},
conclusion : {
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmo...
}
}
]
但我认为实现这一目标不是一个好主意。
我很好奇大多数离线编程应用程序是如何开发的。可能你们大多数人都知道像编程中心、mimo...等等这样的应用程序
,所以请告诉我如何在我的 React Native 应用程序中实现这一点
I'm building a tutorial app with react native. I designed it well but I have no idea how can I store it's data.
I think to Store in object like this...
Tutorial = [
{
Intro : {
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incid quis.."
},
content : {
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do sunt in culpa qui officia deserunt mollit anim id est laborum...
},
conclusion : {
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmo...
}
}
]
But I don't think it's a good idea to achieve this.
I'm so curious about how most of offline programming app developed. Probably most of you know app like programming hub, mimo... Etc
So please mention me how I can achieve this in my react native app
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于大多数较小的数据,您可以使用来自react-native的AsyncStorage ,但是还有更多的数据您可以使用 Realm 和 SQLite 这些库在设备上存储数据。
https://www.npmjs.com/package/react-native-sqlite-存储
https://github.com/realm/realm-js
For most smaller data you can use AsyncStorage from react-native, but there are more data then you can use Realm and SQLite these are libraries to store data on device.
https://www.npmjs.com/package/react-native-sqlite-storage
https://github.com/realm/realm-js