How to avoid duplicating fallback in both API responses and useQuery in React Query?
In fetchOrgs
, I’m already providing a fallback for items
like so:
Tanstack Query + useEffect
This code is working weirdly for useQuery. Apparently on the first button click useQuery will not get the updated value of count while the fetcher function gets the updated value (1). I observed that if you move the useEffect below the useQuery function it works fine. Putting the refetch in the dependency array requires putting the useEffect below the useQuery function.
How to not invalidate sub query in Tanstack query
I have two queries