queryClient.ensureQueryData(...) vs queryClient.fetchQuery(...) inside loader

Looking at https://tanstack.com/router/v1/docs/examples/react/kitchen-sink-react-query

What's the reason for using queryClient.ensureQueryData(...) and then using useSuspenseQuery() over queryClient.fetchQuery(...) and returning the data in the loader, and then using router.useLoaderData() on the other end?
An example showing how to implement Kitchen Sink React Query in React Router
Was this page helpful?