Learn how to bookmark a publication and access all your saved bookmarks.

The bookmarks feature allows a Profile to save references to publications. Each profile maintains a private list of bookmarks. As Lens Bookmarks are stored off-chain, they are instant and do not require signatures or gas to use.

You must be authenticated with a Profile to use bookmarks. See Profile Login for more information.

Bookmark a Publication

You can bookmark a publication for easy access later. If it's no longer needed, you can simply remove the bookmark.

The useBookmarkToggle hook allows you to bookmark a Lens Publication. If the publication is already bookmarked, using this hook will remove the bookmark.

Available in @lens-protocol/react-web and @lens-protocol/react-native

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>  );}

Bookmarked Publications

To determine if a publication has been bookmarked by the logged-in profile, you can use the publication.operations.hasBookmarked property.

const post = publication as Post;
console.log(post.operations.hasBookmarked); // true or false

The publication.stats.bookmarks property of a publication indicates the number of times it has been bookmarked.

const post = publication as Post;
console.log(post.stats.bookmarks); // 42

List All Bookmarks

You can retrieve all the publications bookmarked by the currently logged-in profile.

Use the useBookmarks hook to retrieve all bookmarked publications.

Available in @lens-protocol/react-web and @lens-protocol/react-native

import { useBookmarks } from '@lens-protocol/react-web';
function Bookmarks() {  const { data, loading, error } = useBookmarks();
  if (loading) return <p>Loading...</p>;
  if (error) return <p>Error: {error.message}</p>;
  if (data.length === 0) return <p>No bookmarks found</p>;
  return (    <ul>      { => (        <li key={}>{}</li>      ))}    </ul>  );}

The hook yields a PaginatedReadResult<AnyPublication[]>. For more information on pagination, refer to this guide.