Skip to main content

Function: usePrefetchPreprint()

usePrefetchPreprint(): (uri) => void

Defined in: web/lib/hooks/use-preprint.ts:247

Hook for prefetching a preprint on hover/focus.

Returns

Function

Function to prefetch a preprint by URI

Parameters

uri

string

Returns

void

Remarks

Improves perceived performance by loading preprint data before navigation. Uses the same cache key as usePreprint for seamless transitions.

Example

const prefetchPreprint = usePrefetchPreprint();

return (
<PreprintCard
preprint={preprint}
onMouseEnter={() => prefetchPreprint(preprint.uri)}
onFocus={() => prefetchPreprint(preprint.uri)}
/>
);