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

Function useProfile

  • useProfile(args): ReadResult<Profile, NotFoundError | UnspecifiedError>
  • Fetches a Profile by either its full handle or id.

    const { data, error, loading } = useProfile({
    forHandle: 'lens/stani',
    // OR
    forProfileId: '0x04',
    });

    if (loading) {
    return <Loading />;
    }

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

    return <Profile profile={data} />;

    Parameters

    • args: UseProfileArgs

      UseProfileArgs

    Returns ReadResult<Profile, NotFoundError | UnspecifiedError>

    • Defined in packages/react/src/profile/useProfile.ts:67
  • useProfile(args): SuspenseResultWithError<Profile, NotFoundError>
  • Experimental

    Fetches a Profile by either its full handle or id.

    This signature supports React Suspense.

    const { data } = useProfile({
    forHandle: 'lens/stani',
    suspense: true,
    });

    console.log(data.id);

    This API can change without notice

    Parameters

    • args: UseSuspenseProfileArgs

    Returns SuspenseResultWithError<Profile, NotFoundError>

    • Defined in packages/react/src/profile/useProfile.ts:90

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