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

# Publish draft

> Publish a draft entity, making it publicly visible

## Overview

`usePublishDraft` returns a function that publishes a draft entity. After publishing, `entity.isDraft` becomes `false` and the entity is visible to other users.

## Usage Example

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

function PublishButton({ entityId }: { entityId: string }) {
  const publishDraft = usePublishDraft();

  const handlePublish = async () => {
    const entity = await publishDraft({ entityId });
    console.log("Published, isDraft:", entity.isDraft); // false
  };

  return <button onClick={handlePublish}>Publish</button>;
}
```

## Parameters

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

## Returns

<ResponseField name="Entity" type="Entity">
  The published entity with `isDraft: false`. See [Entity data model](/data-models/entity).
</ResponseField>
