Responsive Advice generator app

Solution retrospective
This is my first project using API, I'm quite happy and proud to have managed to do it!
What specific areas of your project would you like help with?I don't know if this solution I gave for my API is the best using async function()
and await
. If you have any suggestions on how to improve my code, I appreciate it!
Please log in to post a comment
Log in with GitHubCommunity feedback
- @DennyDoesFrontend
Your API doesnt get called when you click the dice. This is because the API (https://api.adviceslip.com/advice) sometimes caches responses, meaning clicking the button might fetch the same advice repeatedly. You can easily fix this by using
const url = `https://api.adviceslip.com/advice?timestamp=${new Date().getTime()}`;
using a timestamp will force the API URL to run again with a fresh response. I hope this helps :)
Marked as helpful
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord