Facing the error when I trying to use fetch(api) this in React.
fetch(url, {mode: "no-cors"})
.then(response => console.log(response.json()))
.catch(error => console.log('Error:', error));
The error message is:
Promise {: SyntaxError: Unexpected end of input at http://localhost:3000/static/js/main.chunk.js:420:46} CalendarCommentary.js:22 Uncaught (in promise) SyntaxError: Unexpected end of input
I'm using react and react-router-dom. I saw other answer is to add a header of server endpoint or something. But I cannot modify the server. Is there any other way to solve this?