Skip to main content

Overview

useAddReaction is a low-level hook that adds a reaction to an entity or comment. For most use cases, use useReactionToggle instead — it handles toggling, optimistic updates, and state management automatically. After an entity reaction succeeds, the entity’s userReaction and reactionCounts are updated in every loaded entity list.
Requires an authenticated user.

Usage Example

Parameters

"entity" | "comment"
required
The type of the reaction target.
string
required
The ID of the entity or comment.
ReactionType
required
The reaction to add: "upvote", "downvote", "like", "love", "wow", "sad", "angry", or "funny".

Returns

Entity | Comment
The updated entity or comment with new reactionCounts and userReaction.