
Design comparison
Solution retrospective
Advice Generator App using React
Hello! This is my second attempt in doing stuff with React! This is another pretty simple project with an API call returning a JSON object.
Consuming a JSON API with Fetch
This free Advice Slip JSON API returns a random JSON response everytime it is called and I used fetch()
to consume it and return the data. To generate a new advice per button click, I used the function Math.floor(Math.random * 20)
to change the state with a new value everytime. At first I thought about using the function to return an ID, but since the API itself always returns a random object by default, I just have to update the state to rerender and call the API again.
Feedback is very welcome!
Questions for the community:
- What did you find difficult while building the project?
Community feedback
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