TanStackT
TanStack3w ago
4 replies
slow-yellow

usequery vs route handlers

Hey I wanted to ask what's the recommended way of fetching data using tanstack start/router,

I noticed it's somewhat omitted from the docs as a choose your own fit, but I wanted to ask if there's any performance benefits / drawbacks between the various approaches?

- pure useQuery
- createServerFn + useServerFn + useQuery
- Route Loader + ensureQueryData + useSuspenseQuery

Also I see there even is an ssr adapter inside router for query as well. Would welcome a bit of a Best Practices section for the various fetching technique (I'm open to even updating docs), but first I'd need an answer on the various approaches
Was this page helpful?