My React Native project has a static JSON file from which I access some properties and I am wondering if it is possible to overwrite that JSON during runtime. Lets say I have a button that makes a GET request for an updated version of that JSON, would it be possible to overwrite that JSON file with the result of my GET request?
I imagine I'd need some sort of React Native filesystem dependency
CodePudding user response:
you can use a state where you put your JSON data, which get updated every time you make a GET request, which is gonna overite the previous state(data) Edit : you can use a caching system with RFNS, we have done that in our app and it works perfectly, you just need to know how to use react-native-fs package.
CodePudding user response:
Yes, head over to RNFS documentation