> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sublay.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Use Upvote Entity

# `useUpvoteEntity`

## Overview

The `useUpvoteEntity` hook provides a way to upvote an entity.

## Usage Example

```tsx theme={null}
import { useUpvoteEntity } from "@replyke/react-js";
import { Button } from "@/components/ui/button";

function EntityComponent({ entityId }: { entityId: string }) {
  const upvoteEntity = useUpvoteEntity();

  const handleUpvote = async () => {
    try {
      const response = await upvoteEntity({ entityId });
      console.log("Entity upvoted:", response);
    } catch (err) {
      console.error("Failed to upvote:", err);
    }
  };

  return <Button onClick={handleUpvote}>Upvote</Button>;
}
```

## Parameters & Returns

### Parameters

The `upvoteEntity` function returned by the hook accepts a single object with the following field:

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

### Returns

The function returns a `Promise<Entity>` representing the API response:

<ResponseField name="response" type="Entity">
  The updated entity after it is successfully upvoted.
</ResponseField>
