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.
SubscribeRelated
TanStack Queryroute.loaderqueryOptionsuseSuspenseQuerydehydratehydratequeryClient.invalidateQueriesrouter.invalidate