Skip to main content

Overview

useRemoveReaction is a low-level hook that removes the authenticated user’s current reaction. For most use cases, use useReactionToggle instead.
Requires an authenticated user.

Usage Example

import { useRemoveReaction } from "@replyke/react-js";

function RemoveReactionButton({ entityId }: { entityId: string }) {
  const removeReaction = useRemoveReaction();

  const handle = async () => {
    await removeReaction({ targetType: "entity", targetId: entityId });
  };

  return <button onClick={handle}>Remove Reaction</button>;
}

Parameters

targetType
"entity" | "comment"
required
The type of the reaction target.
targetId
string
required
The ID of the entity or comment.

Returns

Entity | Comment
Entity | Comment
The updated entity or comment with the reaction removed (userReaction: null and decremented counts).