synchronizing json files on device with a database

无人久伴 提交于 2020-02-06 07:28:50

问题


I want to synchronize data from a nosql database, have it emit json, and when there is a change and the app is online, have the app pull the changes and update them.

My react-native app uses a few language-specific json files loading them dynamically into javascript objects and then using them as my "database". One file for rendering content, one for the app texts, and one for the styles.

When the user changes the language a different directory is used with the same set of json filenames. This is done via the index.js in that directory and loaded into redux.

Must I change the way my app works, and use a NoSQL/real database directly in the app? So that I can use a solution like this one: synchronizing pouchDB with json data (that solution is for working if I understand correctly in the exact opposite direction. The app is working with a database and synchronizing with json received from the web)

Or can I update the data in an external (preferably) NoSQL (pouchDB or couchDB) or relational database, and somehow "synchronize" it with the json files, when the app is connected to the web and have it update?

Is there a known method or framework to accomplish this with react-native?

来源:https://stackoverflow.com/questions/52045560/synchronizing-json-files-on-device-with-a-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!