ReactJS set the request's mode to 'no-cors'

as i was trying to fetch data from the below free API , the fetching failes with the following message , can someone explain to me how to resolve this issue
message " has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled."

https://restcountries.com/v2/all

Yeah, CORS is a pain. I would read up on it. A quick and dirty way to fix it for non-production apps would be with a CORS proxy like these.

1 Like

There is an issue which suggests it was fixed at one point. Maybe it’s broken again. I tried using V3 as well.

You can try https://restcountries.eu instead it seems to work.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.