Hi,
I have just starting doing react and I have the following function which pass 4 values to the API to obtain data objects.
let ratesData = getRatesFromDates(startDateRate, endDateRate, baseCurrency, targetCurrency);
async function getRatesFromDates(startDate, endDate, baseCurrency, targetCurrency) {
try {
let response = await fetch('https://api.exchangeratesapi.io/history?start_at=' +
startDate + '&end_at=' + endDate + '&symbols=' + baseCurrency + ',' + targetCurrency);
let jsonData = await response.json();
return jsonData.rates;
} catch(error) {
console.error(error);
}
}
console.log(ratesData);
In console, these are the data obtained.
I am wondering how I can loop through these data to make use and display them on the webpage or pass certain values to other functions?