Closed rgbkids closed 2 years ago
JSON.parse (empty data) doesn't work properly when I get empty data. In react-fetch, I get Uncaught Syntax Error.
fetch(`http://localhost:4000/notes/-1`)
/notes/:id
res.json(rows[0]);
Just escape it like this
res.json(rows[0] || "null");
https://stackoverflow.com/questions/9158665/json-parse-fails-in-google-chrome
why is the data empty?
i'll close because it's not supposed to be empty. if there's some case where it's empty let's figure out why.
Please read this.
fix: JSON.parse fails in react-fetch #55
JSON.parse fails in react-fetch
JSON.parse (empty data) doesn't work properly when I get empty data. In react-fetch, I get Uncaught Syntax Error.
/notes/:id
Just escape it like this
https://stackoverflow.com/questions/9158665/json-parse-fails-in-google-chrome