State Management · Middle · Question 68 of 75
How do you start an SWR request before the component renders (e.g. on hover)?
- ✓Correct answer: Call
preload(key, fetcher)so a lateruseSWR(key)reuses the in-flight or cached result - 2Call
useSWRin the event handler - 3SWR can't prefetch
Explanation
preload can run outside React (route handlers, hover). Combined with Suspense mode it removes loading waterfalls.