Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

185
Views
No 'Access-Control-Allow-Origin' header is present on the requested resource error in ReactJS using useEffect method

URL1:https://corona.lmao.ninja/v3/covid-19/all URL2:https://corona.lmao.ninja/v3/covid-19/countries

I used the following code to get the contents of above URLs:

const [dailyInfo, setDailyInfo] = useState([]);
const [countries, setCountries] = useState([]);

useEffect(() => {
  axios
      .all([
        axios.get("https://corona.lmao.ninja/v3/covid-19/all"),
        axios.get("https://corona.lmao.ninja/v3/covid-19/countries"),
      ])         
       .then(responseArr => {
          setDailyInfo(responseArr[0].data);
          setCountries(responseArr[1].data);
       })
       .catch(err => {
         console.log(err);
       });
}, []);

This is the error I am getting:

No 'Access-Control-Allow-Origin' header is present on the requested resource.

Here is what I have tried so far

    useEffect(() => {
  axios
      .all([
        axios.get("https://corona.lmao.ninja/v3/covid-19/all"),
        axios.get("https://corona.lmao.ninja/v3/covid-19/countries"),
        { headers: {method: "GET", Accept: "application/json", 'Access-Control-Allow-Origin': '*'}}
      ])
       .then(responseArr => {
          setDailyInfo(responseArr[0].data);
          setCountries(responseArr[1].data);
       })
       .catch(err => {
         console.log(err);
       });
}, []);
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!