【发布时间】:2016-07-14 23:30:30
【问题描述】:
您好,我正在 React Native 中创建一个字典应用程序,我只想存储一个 JSON blob 数组,其中包含每个单词的定义。
我非常希望避免对数据进行硬编码并希望我的代码是 DRY!
示例 JSON blob:
[
{
"word": "triangle",
"definition": "a plane figure with three straight sides and three angles.",
"type": "noun"
},
{
"word": "square",
"definition": "a plane figure with four equal straight sides and four right angles.",
"type": "noun"
},
{
"word": "circle",
"definition": "a round plane figure whose boundary (the circumference) consists of points equidistant from a fixed point (the center).",
"type": "noun"
}
]
存储这些数据的最佳策略是什么:
- 可由用户添加书签
- 干净且易于更改并与其他文件分开
- 我的 React 组件如何访问它
我认为关系数据库是最好的方法,但我很难弄清楚如何为数据库提供数据。以及 React Native 上的哪个库用于关系数据库。
感谢您阅读我的问题。
【问题讨论】:
标签: javascript json database react-native realm