Design comparison
Solution retrospective
Hey ! I have a little problem with my code. I can't get another advice when I click on the button. I can either get the same advice from the API (I can see it because the loading animation is replayed), or nothing happens at all. Anyone know how I can get another response without reloading the page?
Community feedback
- @YourFavoriteKylePosted over 2 years ago
For Svelte, I would recommend using Svelte stores to pass around the advice response.
Import getQuote into your Card.svelte component, and when you call it, set the store value to the response.
From there, you can reference the stores values in your Title and Quote components parameters. You can check out my repo if you need to.
https://github.com/YourFavoriteKyle/advice-generator-app-main
I hope this helps!
0@JukiyoomiPosted over 2 years ago@YourFavoriteKyle Thank you for your response, I will try your idea.
0 - @nikeshnaikPosted over 2 years ago
I have done this challenge, check it out. But don't copy-paste it. Try to learn why it is not working. Also, check APIs, there are different types of requests.
https://github.com/nikeshnaik/advice-generator-app-main/blob/master/index.js
0
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