score:0

Accepted answer
useEffect(() => {
    const getVaccineData = async () => {
      fetch("https://disease.sh/v3/covid-19/vaccine")
        .then((response) => response.json())
        .then((data) => {
          initVaccineInfo(data.phases);
        });
    };
    getVaccineData();
  }, []);

score:0

  fetch("https://disease.sh/v3/covid-19/vaccine")
    .then((response) => response.json())
    .then(({data}) => { <---- destructure the 'data' property here, and use that
      initVaccineInfo(data);
    });

score:0

const getVaccineData = async () => {
      fetch("https://disease.sh/v3/covid-19/vaccine")
        .then((response) => response.json())
        .then((data) => {
          initVaccineInfo(data.phases);
        });
    };
    getVaccineData();

Related Query

More Query from same tag