Pagination with getNftForAddress in react-moralis

I am using react moralis and moralis cloud function “getNFTs” to get all NFTs for a user address. The default page size is 500. But if the user has more than 500 NFTs, how to access the other NFTs.
I want to integrate it with react pagination. Is it possible?
Thanks!

You can use .next() on the response to get the next page results.

https://docs.moralis.io/moralis-dapp/web3-api#web3-api-pagination-examples-with-.next

Thanks. But how do I implement it with react pagination?
I found another example using cursor https://docs.moralis.io/misc/rate-limit#example-of-how-to-use-cursor-nodejs
But this option requires fetching all NFTs, storing them, and then paginating them.

How are you calling the API in code? You mentioned you have a getNFTs cloud function but you can’t use React in cloud code.

With React hooks you could pass in the cursor into the parameters in order to fetch the next page (you could use a state variable / useState).