Random advice generator app using Axios and bootstrap

Solution retrospective
Hi I finished this challenge and I've got a question. How can I make api call by default like as soon as you open the link? I hardcoded an advice for now. Please review my code and give some advice. I appreciate it. Thank you
Please log in to post a comment
Log in with GitHubCommunity feedback
- @zougari47
You can click the button on the page load. I sent you a pull request in GitHub.
Marked as helpful - @shihabmunshi06
you can use conditional rendering, when you have the data you set your fetchingDone state to true (we are using a useState hook here) and the elements will be shown on the page
As far as I know it might take some time to fetch the data when you open a page and submit a request so there might be no IMMEDIATE rendering, you can use a loading spinner or some text if you want to show the fetched data and your page together
you can check my solution as i am using some messages as I am loading the data
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