• useBookmarkToggle hook lets the user save or remove a publication from their bookmarks.

    You MUST be authenticated via useLogin to use this hook.

    You can use the primaryPublication.operations.hasBookmarked property to determine if the publication is bookmarked by the active profile.

    Returns UseDeferredTask<void, never, UseBookmarkToggleArgs>

    Example

    import { AnyPublication, useBookmarkToggle } from '@lens-protocol/react-web';

    function Publication({ publication }: { publication: AnyPublication }) {
    const { execute: toggle, loading } = useBookmarkToggle();

    return (
    <button onClick={() => toggle({ publication })} disabled={loading}>
    {publication.operations.hasBookmarked ? 'Bookmarked' : 'Not bookmarked'}
    </button>
    );
    }