4

I'm trying to use react-native-fs in my app to upload files etc. I followed the installation like the documentation, make the import and i'd put this code for the test :

componentDidMount(){
    const path = RNFS.DocumentDirectoryPath + '/test.txt';
    console.log(path);
    // write the file
    RNFS.writeFile(path, 'Lorem ipsum dolor sit amet', 'utf8')
        .then((success) => {
            console.log('FILE WRITTEN!');
        })
        .catch((err) => {
            console.log(err.message);
    });
}

And it's directly render me this error :

enter image description here ps: I created my project via create-react-native-app

any ideas?

Riajur Rahman
  • 1,794
  • 17
  • 25
E.D
  • 309
  • 4
  • 17

1 Answers1

0

You need link react-native fs in your project . run this in terminal react-native link react-native-fs