Can reactJS write into file? Can reactJS write into file? reactjs reactjs

Can reactJS write into file?


Well the question is, where does that file live?

Node is able to write to files because the files exist on the server that node is running on.

React runs in browser so there is no shared file system to write to. You can read from a file because the contents of that file get bundled into the Javascript that gets served to the browser.

If you want to write to a file, you would need to send an API request from your browser / React to a server and have that server write to the file system.

Additionally, as pointed out by Huy Nguyen, it's possible to write to the clients file system from the browser but that is going to be private to that user.


Your question is a bit vague. In addition to what @Stretch0 said, it's possible to read/write files on a user's computer using the browser's native APIs. Here is a good tutorial.