> ## 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 Entity

# `useDeleteEntity`

## Overview

The `useDeleteEntity` hook is used to delete an existing entity within the project. It ensures the specified entity is removed by making an authenticated request to the server.

## Usage Example

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

function DeleteEntityButton({ entityId }: { entityId: string }) {
  const deleteEntity = useDeleteEntity();

  const handleDelete = async () => {
    try {
      await deleteEntity({
        entityId,
      });

      console.log("Entity deleted successfully");
    } catch (error) {
      console.error("Failed to delete entity:", error.message);
    }
  };

  return <button onClick={handleDelete}>Delete Entity</button>;
}
```

## Parameters & Returns

### Parameters

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

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

### Returns

The function does not return a value but ensures the entity is removed on the server upon successful execution.
