Skip to main content

Overview

useFetchEntityReactionsWrapper is a stateful wrapper around useFetchEntityReactions that manages pagination and reaction list state for you. Use it to build “who reacted” UIs — for example, a modal showing all users who upvoted a post, with infinite scroll. By default the hook does not fetch on mount. Set autoFetch: true to start fetching immediately, or call refetch() manually when you’re ready (e.g., when a modal opens).

Usage Example

Parameters

string
required
The entity to fetch reactions for.
number
Number of reactions per page. Default: 20.
ReactionType
Filter to a specific reaction type. When omitted, all reaction types are returned.
"asc" | "desc"
Sort direction by creation date. Default: "desc".
boolean
If true, fetch automatically on mount. Default: false.

Returns

Reaction[]
The current list of fetched reactions. Appended to on each loadMore call.
boolean
true while fetching the initial page or loading more.
boolean
true if additional pages are available.
() => void
Load the next page of reactions. Appends to the existing list.
() => void
Reset and re-fetch from page 1.