Skip to content
Submitted 14 days ago

Advice generator app with React and Fetch API

react, fetch
LVL 2
@Shadowbest
A solution to the Advice generator app challenge

Solution retrospective


What are you most proud of, and what would you do differently next time?

I am mostly proud of adding a loading to state to the application. Whenever the user generates a new advice, the previous advice text changes to a text saying 'generating advice'. Also adding a simple error state to display in case the app cannot generate a new one.

What challenges did you encounter, and how did you overcome them?

During development I found that reloading the page or generating a new advice using the fetch api, it didn't actually generated a new one (in Firefox). Thought it was the API, but it only cached the request for 2 seconds. I had to add fetch method an init object with a property of cache: "no-store", so it actually fetched a new advice.

What specific areas of your project would you like help with?

Apart from the issue with fetching a new advice in Firefox. I had none. But if there is a better way to handle it, I'm all open ears.

Code
Loading...

Please log in to post a comment

Log in

Community feedback

No feedback yet. Be the first to give feedback on Alvaro Másmela’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