TanStackT
TanStack2y ago
2 replies
radical-lime

How can I use "loader" with "createLazyFileRoute"?

I have this lazy route and I'm not sure how to use the loader function:

export const Route = createLazyFileRoute("/(customers)/customers")({
  loader: async ({ context: { queryClient } }) => {
    return queryClient.ensureQueryData(customersQueryOptions())
  },
  errorComponent: StateError,
  notFoundComponent: StateNotFound,
  component: () => {},
})


does anybody knows how to do it?
Was this page helpful?