0

I am creating a react app and I want to create JSON files for my react application dynamically.

I searched up and found an answer on how to create JSON files in node.js with the fs module. Link: Creating .json file and storing data in it with JavaScript?

That module can't be used in React.

So I need help

Thanks

Lohith K.
  • 13
  • 4
  • 2
    React runs in the browser, and as such has no access to the local file system. You could offer the JSON data as a download to the user, but right after that the file is not reachable from React anymore. – Peter B Jul 08 '21 at 22:11
  • for what u want to create a json file? To cache responses etc? Their are better solutions for that like `redux-persist` or the native Browser Storages – Sysix Jul 08 '21 at 22:14
  • Does this answer your question? [Download JSON object as a file from browser](https://stackoverflow.com/a/30800715/13255493) – encryptedcurse Jul 08 '21 at 22:16
  • ya this does answer my question – Lohith K. Jul 23 '21 at 02:42

0 Answers0