问题
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