TanStackT
TanStack11mo ago
11 replies
hurt-tomato

beforeLoad vs. loader: Clearing Up ensureQueryData Usage

Sorry for the cryptic title, but I'm currently wondering what might be the best location for placing the ensureQueryData function in order to pre-load my data.

Is this assumption correct?

When I need the returned data in my RouteComponent (via Route.useLoaderData), I would place it in the
loader
, otherwise in
beforeLoad
.
Was this page helpful?