On the client side, you can’t arbitrarily save files to the local file system. You can use the File API to launch a save dialog if that works for you. Otherwise you’ll need to have your backend (server) handle that. But that also means saving to the server vs the local file system (unless they’re one in the same), which I’m assuming is what you want since you said from the directory you’re running react.
Kirupa has some tutorials around this, but I think they look all to be pretty old, and I’m pretty sure there’s nothing react-specific (though react isn’t really at play for these kinds of things). You might be better off googling the details.