TkDodo

tkdodo.eu · Personal blog · on HN since 2021

Dominik Dorfmeister (TkDodo), a React Query maintainer, writes about React, TanStack libraries, TypeScript, and frontend code structure.

What HN saysHN commenters recommend it for understanding React Query, including query keys and type narrowing, and it comes up in debates over React's callback model.
21HN people shared it
3linked it in comments
20stories submitted
164story points
4 months agolast shared
2021people per year2026

Most-shared posts

  1. 1
    The Vertical Codebase
    3 people · 6 points · first shared 2026 · discussion on HN
  2. 2
    The Useless UseCallback
    2 people · 110 points · first shared 2025 · 112 comments on HN
  3. 3
    Please Stop Using Barrel Files
    2 people · 16 points · first shared 2024 · 4 comments on HN
  4. 4
    Tooltip Components Should Not Exist
    2 people · 9 points · first shared 2025 · discussion on HN
  5. 5
    Type-Safe React Query
    2 people · 3 points · first shared 2023 · discussion on HN
  6. 6
    Hooks, Dependencies and Stale Closures
    1 people · 6 points · first shared 2022 · discussion on HN
  7. 7
    The Beauty of TanStack Router
    1 people · 3 points · first shared 2025 · discussion on HN
  8. 8
    Working with Zustand
    1 people · 3 points · first shared 2022 · discussion on HN
  9. 9
    XState Store – TkDodo's Blog
    1 people · 2 points · first shared 2025 · discussion on HN
  10. 10
    React Query meets React Router (v6.4)
    1 people · 2 points · first shared 2022 · discussion on HN
  11. 11
    Array Types in TypeScript
    1 people · 1 points · first shared 2023 · discussion on HN
  12. 12
    Using WebSockets with React Query
    1 people · 1 points · first shared 2022 · discussion on HN
  13. 13
    Building Type-Safe Compound Components
    1 people · 1 points · first shared 2026 · discussion on HN
  14. 14
    Avoiding Hydration Mismatches with UseSyncExternalStore
    1 people · 1 points · first shared 2024 · discussion on HN
  15. 15
    React query and type script
    1 people · first shared 2021

What HN people wrote when they linked it

fabian2k · 2023-10-19
It was more of a general misunderstanding on how React Query is supposed to work, partially triggered by some mistakes in defining the query keys that meant that React Query didn't work as intended. I'd recommend this blog post (or actually all blog posts on React query on that site): https://tkdodo.eu/blog/effective-react-query-keys What I observed was that the query keys were not consistently defined, which broke automatic refetching when the data was modified and invalidated. So the developer added some manual refetches because they thought React Query couldn't handle that automatically. You need a consistent structure for your query keys and use that everywhere. Then you only need to make sure to invalidate the correct part of the query key hierarchy and the rest works automatically.
tshaddox · 2021-11-03
I believe this will also obviate a common recommendation to not destructure when using React Query: https://tkdodo.eu/blog/react-query-and-type-script#type-narrowing
CharlieDigital · 2025-09-15
Actually, React's problem is that it's the inverse of how HTML and JavaScript works in terms of how to handle callbacks. Of the major UI frameworks, it is the only one with this quality (Vue, Svelte, Angular, Solid, etc. use signals). This inverted behavior is the cause of most of the pain and footguns in React and React Hooks because the way state behaves in a React component is not the way state behaves in any other front-end JS one would normally write. That's why I think for some folks who started with HTML + vanilla JS, React Hooks just feels wrong. It points the reactive callback to the component function whereas every other framework/library uses some sort of signal to point the reactive callback to a handler. Because React points the callback to the component function, then you have to be really cautious about where you put state inside of a component[0][1][2] Even You wrote this about React's design choice which I think sums it up best: > The pain and suffer[ing] of hooks all roots from the mismatch between a dogmatic belief in the superiority of immutability and the harsh reality of the host language that is JavaScript If you want to "feel" this for yourself, here are a series of JSFiddles: - Vanilla: https://jsfiddle.net/qtmkbdo2/8/ - Vue: https://jsfiddle.net/vys2rmup - React: https://jsfiddle.net/0gjckrae/1/ It should be obvious that Vanilla and Vue behave like how one would expect callbacks to work. React, because it points the callback to the…

Keyboard shortcuts

/Search
j kNext / previous blog
EnterOpen selected blog
vVisit the blog site
fFollow / unfollow
lSwitch grid / list view
dSwitch dark mode
g hHome
g pTop posts
g tTopics
g fFollowing
g lLiked
g yHistory
g qFAQ
EscBack / close