• Preparing search index...
  • The search index is not available
Lens SDK Reference
  • Lens SDK Reference
  • @lens-protocol/react-web
  • Core
  • useSearchProfiles

Function useSearchProfiles

  • useSearchProfiles(args): PaginatedReadResult<Profile[]>
  • useSearchProfiles is a paginated hook that lets you search for profiles based on a defined criteria

    function SearchProfiles() {
    const { data, error, loading } = useSearchProfiles({ query: 'foo' });

    if (loading) return <Loader />;

    if (error) return <Error message={error.message} />;

    return (
    <ul>
    {data.map((profile) => (
    <li key={profile.id}>{profile.handle}</li>
    ))}
    </ul>
    );
    }

    Parameters

    • args: {
          limit?: InputMaybe<LimitType>;
          orderBy?: InputMaybe<ProfilesOrderBy>;
          query: string;
          where?: InputMaybe<ProfileSearchWhere>;
      }
      • Optional limit?: InputMaybe<LimitType>
      • Optional orderBy?: InputMaybe<ProfilesOrderBy>

        The order by which to sort the profiles

      • query: string

        Query for the profile search

      • Optional where?: InputMaybe<ProfileSearchWhere>

        Filtering criteria for profile search

    Returns PaginatedReadResult<Profile[]>

    • Defined in packages/react/src/discovery/useSearchProfiles.ts:56
  • useSearchProfiles(args): SuspensePaginatedResult<Profile[]>
  • Experimental

    useSearchProfiles is a paginated hook that lets you search for profiles based on a defined criteria

    This signature supports React Suspense.

    const { data } = useSearchProfiles({
    query: 'foo',
    suspense: true,
    });

    console.log(data);

    Use startTransition to avoid to re-suspend the component.

    const [query, setQuery] = useState('bob');

    const { data } = useSearchProfiles({
    query,
    suspense: true,
    });

    const search = () => {
    startTransition(() => {
    setQuery('foo');
    });
    };

    This API can change without notice

    Parameters

    • args: UseSuspenseSearchProfilesArgs

    Returns SuspensePaginatedResult<Profile[]>

    • Defined in packages/react/src/discovery/useSearchProfiles.ts:93

Settings

Member Visibility

Theme

Lens SDK Reference
  • @lens-protocol/react-web - v2.3.2
  • @lens-protocol/react-native - v2.3.2
  • @lens-protocol/client - v2.3.2