@lens-protocol/react
Version:
Interacting with the Lens Protocol API using React.
30 lines (29 loc) • 928 B
TypeScript
import { Comment } from '@lens-protocol/api-bindings';
import { UseDeferredTask } from "../helpers/tasks.js";
export type UseHideCommentToggleArgs = {
comment: Comment;
};
/**
* This hook enables the author of a publication to toggle the visibility of a comment on their publication.
*
* You MUST be authenticated via {@link useLogin} to use this hook.
*
* @example
* ```tsx
* import { Comment, useHideCommentToggle } from '@lens-protocol/react-web';
*
* function HideableComment({ comment }: { comment: Comment }) {
* const { execute: toggle, loading } = useHideCommentToggle();
*
* return (
* <button onClick={() => toggle({ comment })} disabled={loading}>
* {comment.hiddenByAuthor ? 'Unhide' : 'Hide'}
* </button>
* );
* }
* ```
*
* @category Publications
* @group Hooks
*/
export declare function useHideCommentToggle(): UseDeferredTask<void, never, UseHideCommentToggleArgs>;