How Do I Modify A Json File With React?
I want to modify a JSON file in react. Is there any way to do so? I have this code which is run when I click on an html element. At the end it calls VoteTracking which is the funct
Solution 1:
Since you mention that you click on an element to trigger file modification, I assume that your React program runs in a browser. While fs
is part of the Node runtime, for security reasons there is no such thing in browser runtimes, except for some proprietary extensions.
As a workaround, the React page could send the JSON document to the server, which is able to store the file, or download it back to the client machine.
Post a Comment for "How Do I Modify A Json File With React?"