Skip to content
Advertisement

React js fetch API

I am learning React.js and trying to fetch API like this

JavaScript

and this is the error I get

http://prntscr.com/k36ggq

I am pretty new in this, so if anyone can help me with this that would be great. Thanks

Advertisement

Answer

Try by setting the header as follows. https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS You just remove the mode: ‘no-cors’ in your code,

JavaScript

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement