Should React-Query only be used for APIs and not other async operations?

I'm working on a project involving connecting to a bluetooth device, which is an async process. I've opted to use react query to get the same state management that I'd expect from an API call, but I'm getting some pushback from the other devs on my team saying it should just be used for API management. Curious what everyone else's thoughts were because I always operated under the thought that react-query is state management for anything async, not just APIs
2 Replies
Brendonovich
Brendonovichβ€’2y ago
I'd say you're right on the money, it's a great way to manage any async operation. Theo has talked about it before, and a friend of mine posted an example of lazily importing a file with it a while back: https://twitter.com/oscartbeaumont/status/1570648920644288517
oscartbeaumont (@oscartbeaumont)
Your daily reminder that @tan_stack React Query can be used for far more than fetching data from your API. Lazy loading a static JSON file, it's got you!
Likes
187
From oscartbeaumont (@oscartbeaumont)
Twitter
isaac_way
isaac_wayβ€’2y ago
Dominik πŸ‡ΊπŸ‡¦ (@TkDodo)
What are some things that you use TanStack Query for that is not data fetching? Curious to know what other use-cases you all have πŸ˜„
Twitter
Want results from more Discord servers?
Add your server