I’m having an issue displaying my nfts after calling them… I have previously used useMoralisQuery to call listed nfts in my moralis database which does not require an async function so I was able to create a map of the nfts and display them on a card component… (see example)
const { data: listedNfts, isFetching: fetchingListedNfts } = useMoralisQuery(
// TableName
// Function for the query
"ActiveItem",
(query) => query.limit(10).descending("tokenId")
)
console.log(listedNfts)
listedNfts.map((nft) => {
console.log(nft.attributes)
const { price, nftAddress, tokenId, marketplaceAddress, seller } =
nft.attributes
return (
<div >
<Card
price={price}
nftAddress={nftAddress}
tokenId={tokenId}
marketplaceAddress={marketplaceAddress}
seller={seller}
key={`${nftAddress}${tokenId}`}
/>
</div>
)
})
However - I am finding it difficult to do the same with fetchNFTs since it is an async function and so wrldhorse only exists within it… Does anyone have any direction regarding this?
const fetchNFTs = async () => {
const options = {
chain: "rinkeby",
address: address,
};
const wrldhorse = await Moralis.Web3API.account.getNFTs(options);
console.log(wrldhorse)
}