Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

advice-generator-app using react hooks

ify47 360

@ify47

Desktop design screenshot for the Advice generator app coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
  • API
2junior
View challenge

Design comparison


SolutionDesign

Solution retrospective


my second react project, Your feedback is highly recommended.

Community feedback

Mukwende 1,370

@mukwende2000

Posted

First of all this is not a form, so handleSubmit doesn't fit as a name for the click handler. handleClick would be better, you shouldn't fetch data outside of a useEffect, so the handleSubmit should not be fetching the data, instead i suggest you set a certain state and change the state when you click the button, and to trigger the fetch, you can add that state in the dependecy array. Lastly i really can't see the reason why your looping through the slip. It is not an array you can just do fine by extracting the id and the advice directly into the jsx.

Marked as helpful

0

ify47 360

@ify47

Posted

@mukwende2000

thanks for the feedback, i have made the necessary changes, i understood my mistakes and learned from it,

Also i am passing a usEffect to call the api on page load once, I look forward to getting more feedback from you, thanks :)

1
Mukwende 1,370

@mukwende2000

Posted

yeah, that look much better now, never stop learning, congratulations on completing the challenge

0

Please log in to post a comment

Log in with GitHub
Discord logo

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