Skip to content
masterclass Buddy

TanStack · Pipe

loader

Use a route loader to prefetch critical data from an external cache or data library before the route renders. The component then reads the same cache, while router dehydration and hydration can transfer that data between server and client.

Last updated

Syntax

createFileRoute('/path')({ loader: () => dataClient.query(options), component: Component })

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • TanStack Query
  • route.loader
  • queryOptions
  • useSuspenseQuery
  • dehydrate
  • hydrate
  • queryClient.invalidateQueries
  • router.invalidate

Source: External Data Loading | TanStack Router Docs. Checked 2026-11-03.