Reputation: 99
I have a file call data.txt in the root of my project same directory as App.js and package.json. I want to open the file data.txt read though the lines, change somethings, and save it back. This is done in a component. Is this possible in Reactjs? if it is can you kindly give me an example i can follow or links to where i can see an example.
Upvotes: 0
Views: 598
Reputation: 21364
React (typically) runs in the browser, but the file you are talking about lives on the server. So no, not just like that. You'd need to create some sort of API to send the data to the browser and back.
Upvotes: 1