State Management · Middle · Question 66 of 75
How can you make opening a detail page feel instant?
<Link to={`/posts/${id}`} onMouseEnter={() => queryClient.prefetchQuery(postQuery(id))}>- ✓Correct answer: Prefetch the query on hover or focus so the cache is warm when the page renders
- 2Disable caching for detail pages
- 3Fetch all details on app start
Explanation
Prefetching respects staleTime, so repeated hovers don't spam the server. Routers with loaders can call ensureQueryData similarly.