Design comparison
Community feedback
- @a-maystorovPosted over 2 years ago
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 helpful1@CyrusKabirPosted over 2 years ago@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
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