simplest Posted January 2, 2021 Share Posted January 2, 2021 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? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now