@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
@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.
@a-maystorov
Posted
@CyrusKabir Happy to help.