Trajectory Prediction Over Hover Prefetching
Hover prefetching starts too late. Trajectory prediction fires while the cursor is still in motion, reclaiming 100-200ms.
Incorrect (waits for hover):
<Link
href="/about"
onMouseEnter={() => router.prefetch("/about")}
>
About
</Link>Correct (trajectory-based):
const { elementRef } = useForesight({
callback: () => router.prefetch("/about"),
hitSlop: 20,
name: "about-link",
});
<Link ref={elementRef} href="/about">About</Link>