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

Function useLazyProfile

  • useLazyProfile(): UseDeferredTask<Profile, NotFoundError | UnspecifiedError, FetchProfileArgs>
  • Experimental

    useLazyProfile is a lazy version of useProfile React Hook.

    This hook will not fetch the profile until the returned function is called.

    This hook is intended to enable more complex use cases, the vast majority of use cases should use useProfile instead.

    Returns UseDeferredTask<Profile, NotFoundError | UnspecifiedError, FetchProfileArgs>

    Example

    const { called, data, error, loading, execute } = useLazyProfile();
    

    This hook is experimental and may change in the future.

    const { called, data, error, loading, execute } = useLazyProfile();

    const callback = async () => {
    const result = await execute({ forProfileId: profileId });

    if (result.isFailure()) {
    toast.error(result.error.message);
    return;
    }

    const profile = result.value;

    // do something with profile
    }
    • Defined in packages/react/src/profile/useLazyProfile.ts:54

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