so this is my api, which is stored in a url "https://covid19.mathdro.id/api/confirmed"
this is my api index file
import axios from "axios";
const url = "https://covid19.mathdro.id/api/confirmed";
export const fetchData = async () => {
try {
const {
data: countryRegion ,
} = await axios.get(url);
return { countryRegion };
} catch (error) {
return error;
}
};
in this sandbox code, i have tried to take the value of countryRegion from the api, but it appears as undefied in the console. https://codesandbox.io/s/react-chartjs-2-nqo9n