Denshin / Blog / Engineering
On hating React Query for two days, then reaching for it forever
A frank account of why TanStack Query feels wrong before it feels right, the mental shift that fixed it, and the conventions we now bring to every project.
Denshin Engineering · Engineering Team · 23 April 2026 · 2 min read
I want to start with what's embarrassing: I spent the first two days of using TanStack Query trying to figure out what was wrong with it.
The team had decided to migrate one of the dashboards off Redux and onto something lighter. I picked up the ticket on a Tuesday. By Thursday I had a Notion doc full of complaints. The cache was "magic". The query keys felt like a footgun. The dev tools showed a wall of grey-and-green pills that didn't tell me anything about what my screen was actually doing.
The thing I was missing (and it took a longer flight and a coffee with our backend lead to see it) is that React Query isn't a state library at all. It's a server-cache library. Once you stop expecting it to be Redux With Hooks and start treating server data as a separate, asynchronous thing that lives slightly outside your component tree, almost all the friction goes away.
A few things flipped for me:
- I stopped writing reducers for "loading" and "error" booleans. Those are derivable.
- I stopped thinking of mutation success as an event I had to broadcast to other components. Invalidate the right query keys, walk away.
- I started naming queries by the thing they fetch, not the screen they fetch it for.
['blogs', { status: 'published' }] is a real key. ['dashboardBlogs'] is regret waiting to happen.
We have one centralised query keys file in every project now. It is the only piece of "library code" we still hand-roll, because it forces a conversation about what the server actually owns. New endpoints don't get hooks until they get a key in that file, and reviewers know to push back if a key looks ad-hoc.
The other thing that took a while: staleTime is the dial that matters. The default of zero is a debugging-friendly default, not a production one. Most of our admin lists run with a stale time of a minute or two. The pages feel instant, the network tab calms down, and the user almost never sees a stale value because mutations invalidate the relevant keys anyway.
If you're three days into TanStack Query and grumpy, I get it. Stick with it. Day four is good.
Tags: React, TanStack Query, Frontend, State Management
All posts · Work with Denshin