Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 1 year ago

Advice generator using React and tailwind-css

react, tailwind-css, vite
Ricardo Bermúdez•100
@ridabelaco
A solution to the Advice generator app challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


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

I feel the generator functions in a good way, i'm happy with how it works using a random generator to pick an advice from the api at random instead of waiting every 2 seconds for the advice that is fed from the plain api to change.

At this moment i don't think I would have done anything different.

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

Understanding how the advice slip json api worked, and using useeffect hook from react to change fetch the advice and change it everytime the button was clicked.

I had the problem that using just the plain advice fetch wouldn't change the advice, so a work around was to generate a random number and fetch the advice number corresponding to this random number generated, that way it ensured i would get a random advice everytime without the 2 seconds wait from the plain api and it fixed my problem.

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

Any advice or feedback would be appreciated.

Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on Ricardo Bermúdez'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

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner
  • Use cases

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License