WP Kernel API / @wpkernel/ui / usePrefetcher
Function: usePrefetcher()
ts
function usePrefetcher<TRecord, TQuery>(resource): Prefetcher<TQuery>;
Exposes stable cache prefetch helpers for a resource.
Wraps the kernel resource's prefetchGet
and prefetchList
helpers so React components can wire them to UI affordances (hover, visibility, etc.) without re-creating callback instances on every render.
Type Parameters
TRecord
TRecord
TQuery
TQuery
= unknown
Parameters
resource
ResourceObject
<TRecord
, TQuery
>
Returns
Prefetcher
<TQuery
>