fetched data using axios and set data using state
Design comparison
Solution retrospective
noticed that whenever my app renders it generates new advice, so i thought that onclick of the dice my page should refresh.. any other better solution? instead of using that?
Community feedback
- @alQaisiPosted over 2 years ago
Hi John, React component re-render whenever the state changes, so you can make a function that handles the request and changes the state with the new data, you should pass that function as a call back to the button. You can keep your work, but it is not the right implementation for this project.
Great work by the way.
0@john-the1-mwagiruPosted over 2 years ago@alQaisi anytime i tried creating a state to handle a request i inturn got an error stating too many rerenders , guess its because of the useEffect hook? Anyway thank you Ahmad for the feedback, appreciate it.
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