Skip to content
RESN
GitHub

TanStack Query

  • Performant and powerful data synchronization

Purpose

  • TanStack Query makes server-side data fetching and caching so unbelievably easy
  • The createQuery and createMutation hooks are wrappers around promises (e.g. fetch) which allows monitoring loading, success and error states much more programatically
  • The “tagging” system gives you direct power about what you want to invalidate and when

Alternatives

  • SvelteKit has built-in server-side data fetching and submitting
  • This is currently used for the registration/login system as it means that the initial page load already knows if the user has logged in or not, so you don’t get a flash of “loading” before the navbar appears or before you get redirected