Skip to content
Submitted about 3 years ago

Fetching JSON data in react

react
@mackieva
A solution to the Advice generator app challenge

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.

Code
Loading...

Please log in to post a comment

Log in

Community 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