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

Function useLazyPublications

  • useLazyPublications(): UseDeferredTask<AnyPublication[], UnspecifiedError, FetchPublicationsArgs>
  • Experimental

    useLazyPublications is a lazy version of usePublications React Hook.

    This version doesn't support pagination!

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

    This hook is experimental and may change in the future.

    Returns UseDeferredTask<AnyPublication[], UnspecifiedError, FetchPublicationsArgs>

    Example

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

    const callback = async () => {
    const result = await execute({
    where: {
    publicationTypes: [PublicationType.Post]
    }
    });

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

    const publications = result.value;

    // do something with the publications
    }
    • Defined in packages/react/src/publication/useLazyPublications.ts:52

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