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 || Sass && Fetch API

#sass/scss#fetch
CyrusKabir 1,885

@CyrusKabir

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

Community feedback

@a-maystorov

Posted

Hi 👋, excellent job on this challenge!

Your question about working with APIs in a more flexible, scalable, and maintainable way depends on the project itself honestly and how many API calls you need to make. I would suggest making a reusable fetchData function or useFetch hook in react, where you pass the URL endpoint as an argument and handle the response inside that function. That way, you can make your API calls anywhere in your project without rewriting the fetch function from scratch. But in this case, where you have only one fetch request, I don't think it's necessary.

I'm not sure if this will help you out, but you can check my solution to the Clock App challenge if you would like a code example. I'm using a reusable fetch function to make calls to three different endpoints. That would give you an idea about maintainability and scalability.

I hope this answers your question; keep on rocking 👊 👩‍💻 💯.

Marked as helpful

1

CyrusKabir 1,885

@CyrusKabir

Posted

@SirDev97 thank you so much my dear friend ♥ and yes now I have my answer because I didn't know it's not that important in little projects like this.

0

@a-maystorov

Posted

@CyrusKabir Happy to help.

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