Skip to main content

Overview

useUpdateComment returns a function that updates an existing comment. At least one of content or metadata must be provided.

Usage Example

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

function EditComment({ commentId }: { commentId: string }) {
  const updateComment = useUpdateComment();

  const save = async (newContent: string) => {
    const updated = await updateComment({ commentId, content: newContent });
    console.log("Updated:", updated.id);
  };

  return <button onClick={() => save("Edited content")}>Save</button>;
}

Parameters

commentId
string
required
The ID of the comment to update.
content
string
New text content. Must be at least 1 character.
metadata
Record<string, any>
Replacement metadata object.

Returns

Comment
Comment
The updated comment. See Comment data model.