Fetching JSON data in react

Solution retrospective
I'm continuing the React basics practice while also starting to work with fetching JSON data so this was a good one. I'm not sure best practices so this was just getting the info on load and when clicking the dice button. I used state to store the advice object and a random number for picking the advice object on the fetch url, also useEffect for the initial displaying on load, if you used react for this I'd like to know how you accomplished that to just see the different ways this can be done.
Please log in to post a comment
Log in with GitHubCommunity feedback
No feedback yet. Be the first to give feedback on Ryan McGuire's solution.
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