#Get loader function context type for a route?

2 messages · Page 1 of 1 (latest)

pseudo merlin
#

Is there a way to get the loader context type for a specific route for code split loaders?
e.g.
export const loader = (ctx: <context type for "/foo">) => ...

proper ingot
#

Yes, you can use the the FileRouteLoader api

export const loader = FileRouteLoader("/blog/$blogId")(async ({
    context: { queryClient, fetchBlogIdOptions },
}) => {
    queryClient.ensureQueryData(fetchBlogIdOptions);
});