Skip to main content

Overview

useDeleteComment returns a function that deletes a comment. When used inside a CommentSectionProvider, prefer deleteComment from useCommentSection — it handles the Reddit-style soft-delete UI automatically.

Usage Example

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

function DeleteButton({ commentId }: { commentId: string }) {
  const deleteComment = useDeleteComment();

  return (
    <button onClick={() => deleteComment({ commentId })}>Delete</button>
  );
}

Parameters

commentId
string
required
The ID of the comment to delete.

Returns

Promise<void> — resolves when the comment is deleted.