0

I am sort of losing my mind at this. I simply want to write to a JSON file at runtime while debugging my app. I have a redux store state I want to view cleanly in a file while I debug, so I figured I would simply export/write the object to a file.

I am now realizing this is way more confusing to do than I thought, as I cannot simply use Node.js and fs.writeFile()

Why is this so complicated, and what can I do? If writing to a file on my project directory is not possible, how else can I cleanly view the state of my redux store? console logging the state is way too messy.

  • https://stackoverflow.com/questions/21012580/is-it-possible-to-write-data-to-file-using-only-javascript – Omar May 12 '21 at 22:37

1 Answers1

0

You cannot use fs.writeFile() because that is a server-side function and react native is client-side.

What you can do is console log it to terminal.

You can also stringify it and send it as a query parameter to your server and write code to process it.

Or you can send it in the request body of a post request and write code to handle that request body.

Omar
  • 3,401
  • 2
  • 23
  • 40