> ## Documentation Index
> Fetch the complete documentation index at: https://replyke-feat-push-rich-payload-fields.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Use Delete Comment

# `useDeleteComment`

## Overview

The `useDeleteComment` hook allows users to delete a specific comment by its ID. This is useful for implementing comment moderation or user-controlled deletion features in your application.

## Usage Example

```tsx theme={null}
import { useDeleteComment } from "@replyke/react-js";

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

  const handleDeleteComment = async () => {
    try {
      await deleteComment({ commentId });
      console.log("Comment deleted successfully.");
    } catch (error) {
      console.error("Failed to delete comment:", error.message);
    }
  };

  return <button onClick={handleDeleteComment}>Delete Comment</button>;
}
```

## Parameters & Returns

### Parameters

The hook returns a function that accepts an object with the following field:

<ParamField path="commentId" type="string" required>
  The ID of the comment to be deleted.
</ParamField>

### Returns

The function does not return a value but ensures the specified comment is deleted upon successful execution.
