Discovering Profiles
Learn how to discover new users and search Lens Profiles.
Search
Search through Lens Profiles to find the user you are looking for.
- React SDK
- JavaScript SDK
- API
The useSearchProfiles hook allows you to search for Lens Profiles.
Available in @lens-protocol/react-web and @lens-protocol/react-native
import { useSearchProfiles } from '@lens-protocol/react-web';
function SearchProfiles() { const { data, error, loading } = useSearchProfiles({ query: 'foo' });
if (loading) return <p>Loading...</p>;
if (error) return <p>Error: {error.message}</p>;
if (data.length === 0) return <p>No profiles found</p>;
return ( <ul> {data.map((profile) => ( <li key={profile.id}>{profile.handle?.fullHandle ?? profile.id}</li> ))} </ul> );}
The hook yields a PaginatedReadResult<Profile[]>. For more information on pagination, refer to this guide.
Explore
Explore Lens Profiles by sorting them based on various criteria.
- React SDK
- JavaScript SDK
- API
The useExploreProfiles hook enables you to browse through Lens Profiles.
Available in @lens-protocol/react-web and @lens-protocol/react-native
import { useExploreProfiles, ExploreProfilesOrderByType} from '@lens-protocol/react-web';
export function ExploreProfiles() { const { data, error, loading } = useExploreProfiles({ orderBy: ExploreProfilesOrderByType.MostFollowers, });
if (loading) return <p>Loading...</p>;
if (error) return <p>Error: {error.message}</p>;
if (data.length === 0) return <p>No profiles found</p>;
return ( <ul> {data.map((profile) => ( <li key={profile.id}>{profile.handle?.fullHandle}</li> ))} </ul> );}
The hook yields a PaginatedReadResult<Profile[]>. For more information on pagination, refer to this guide.