Advice Generator App (HTML / CSS (Less) / Vanilla JS)

Solution retrospective
I'm especially searching for advice about (better?) ways to deal with API, here :).
Please log in to post a comment
Log in with GitHubCommunity feedback
- @elaineleung
Hi Teru-san, I don't know whether it's working for you, but for me it seems that once the component is loaded, it keeps giving the same advice. If that's the case for you as well, here are two suggestions you can try:
-
In the url for the API, you can try adding a backslash (i.e.,
https://api.adviceslip.com/advice/
instead ofhttps://api.adviceslip.com/advice
) as the API may need a specific path -
Also in the URL, you can try adding a random number that goes at the end of the URL, something like this:
const random = Math.floor(Math.random() * 100) // Just a suggested number const url = `https://api.adviceslip.com/advice/${random}` fetch(url).then( // more code here )
-
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