@dquinn089
Posted
You're doing a great job with the project! The structure is clear, and you've got a good handle on fetching and updating the data. One tip for improvement would be to ensure that the fetchData()
function returns the data only after it's been used to update the cards. This way, the updateCards
function will only run after the data is fully loaded and available. Here's a small adjustment:
const data = await request.json();
// Initial update of the cards
updateCards('weekly'); // Set default timeframe to 'weekly'
return data;
This ensures that the cards are updated immediately after the data is fetched, and the default timeframe (weekly) is set right away. Happy Coding!