Design comparison
Solution retrospective
Can't figure out why I get the same data by clicking the button???
Community feedback
- @MelvinAguilarPosted about 2 years ago
Hi @Andy-Esm π, good job on completing this challenge! π
This API mentions the following in its documentation: Note: Advice is cached for 2 seconds. Any repeat-request within 2 seconds will return the same piece of advice. You can add the header
cache: 'no-cache'
to your fetch, but this will allow the button to be spammed. During the first two seconds after pressing the button, the button should be disabled or something should indicate that it is loadingGood job, and happy coding!
Marked as helpful2 - @md5daltonPosted about 2 years ago
Hello Andrey Esman π
Well done with your solution for this challenge π
Excellent advice from @MelvinAguilar and if you were wondering how to add that no-cache option, here's how you can do it:
fetch ("https://api.adviceslip.com/advice", {cache: "no-cache"})...
Cheers π
Marked as helpful1
Please log in to post a comment
Log in with GitHubJoin 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