When working in @tan_stack React query, I use setQueryData instead of...


When working in @tan_stack React query, I use setQueryData instead of invalidateQueries when possible.

Here's why: setQueryData instantly updates the query cache. In contrast, invalidateQueries triggers an HTTP request, which often leads to a slower UI update.

setQueryData benefits:
✅ Instantly updates the UI
✅ Save bandwidth (avoids an HTTP request)

View original on X