I resisted TanStack Query for longer than I should have. I had useEffect + useState patterns that worked. Why add a dependency? Then I used it on a real project and understood immediately why people rave about it.
The problem with DIY data fetching
The typical pattern everyone writes doesn't handle: stale data, background refetching, request deduplication, cache invalidation, pagination, or optimistic updates. You end up building all of that yourself, badly, one bug at a time.
What TanStack Query gives you for free
Automatic caching, background refetch on stale data, deduplication (multiple components using the same query = one request), loading/error states, retry on failure, and refetch on window focus. All from a single useQuery call.
UseQuery > useEffect, I swear your code will look so much more satisfying
— Me
When I'd still skip it
In Next.js App Router projects where you're fetching on the server with RSC, you often don't need it at all. TanStack Query shines in client-heavy SPAs where you need a smart cache layer between your components and your API. Know your rendering model and reach for the right tool.