DEV Community

Discussion on: Controlling React API Calls With Hooks

Collapse
 
cliffordfajardo profile image
Clifford Fajardo • Edited

+1 about is react-query here.
React query is a lot simpler than apollo IMO, & is backend agnostic (REST, GQL, etc) & perhaps most importantly for getting started, its just a set of hooks 😄
I really do appreciate the code snippets in this article & thoughts 💭,. Personally, I wouldnt recommend the code in here production usage for a few reasons: There's probably a dozen+ of things that this doesn't handle (caching, request-deduping, cache access, etc), which something like react-query's hooks give you for free & its a very tiny library:

Collapse
 
bytebodger profile image
Adam Nathaniel Davis

I def don't disagree with any of this. I just wanted to point out that it's entirely possible to responsibly manage your API calls without using any third-party package (and without blindly accepting that some of your basic data calls will simply need to be called repeatedly for no functional reason).

Thread Thread
 
cliffordfajardo profile image
Clifford Fajardo

Thanks for the clarification 🙏