How to add pagination in get post query

Hello,

I am using below function to get the posts.

const liveCollection = await PostRepository.queryPosts(queryParams);

currently queryParams is supporting only limit value. but I want to add the next/prev page value to the query params so that I can fetch the page just like in amity console.

Is there anyway I get next and previous page from the query object and add those page on next call?

Hello, is this something you’re seeking for?

  const liveCollection = PostRepository.queryCommunityPosts({
        communityId: communityId,
      });

      liveCollection.on("dataUpdated", (posts) => {
        console.log(posts.length);
      });

      setLivePosts(liveCollection);
    }
  }, [connected, communityId]);

  function onNextPage() {
    if (livePosts.hasMore) {
      livePosts.nextPage();
    }
  }