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?React Router Kitchen Sink React Query Example | TanStack Router Docs
An example showing how to implement Kitchen Sink React Query in React Router
0 Replies