i want to write to a JSON file so i used react-native-fs
here is the code:
const add = (n, p, pr) => {
var RNFS = require('react-native-fs');
var filePath = RNFS.DocumentDirectoryPath + '/items.json';
RNFS.writeFile(filePath, '{name:hello}', 'utf8')
.then((success) => {
console.log('SUCCESS');
})
.catch((err) => {
console.log(err.message);
});
};
it log success but didn't update the file any ideas?