Capítulo 77 de 80
The Suspense-safe way to prefetch — call during render, before a <Suspense> boundary wraps the component that actually calls useSuspenseQuery for that same data, so the fetch starts without itself suspending.
queryClient.query() accepts; queryKey required, queryFn required unless a default is registered.<Suspense> boundary that wraps the actual useSuspenseQuery consumer — calling it inside the boundary (or using useSuspenseQuery itself to "prefetch") defeats the purpose.function ArticleLayout({ id }) {
usePrefetchQuery({ queryKey: ['article-comments', id], queryFn: getArticleCommentsById })
return <Suspense fallback="Loading article"><Article id={id} /></Suspense>
}
useSuspenseQuery itself to prefetch — it would suspend the calling component, defeating the point. This hook is the dedicated, non-suspending alternative.