What is the tanstack way of doing loading? (Example: Next.js has loading.tsx)
Is there a way i can add a loader to a specific road that does server-side loader?
4 Replies
national-gold•3w ago
are you looking for deferred loading?
you can use Await or just React.use. this will suspend your route component and then should cause the pending component to be rendered
rare-sapphireOP•3w ago
aha thanks! 😄
Yeah, deferred loading 🙂
rising-crimson•3w ago
Yeah, use pending component: https://tanstack.com/router/latest/docs/framework/react/api/router/RouteOptionsType#pendingcomponent-property
RouteOptions type | TanStack Router React Docs
The RouteOptions type is used to describe the options that can be used when creating a route. RouteOptions properties The RouteOptions type accepts an object with the following properties: getParentRo...
rising-crimson•3w ago
And useSuspenseQuery should use it properly too