Moralis React get Nft Balance

I set up moralis react according to the documentation, but when I try to get NFT balance, the user is now authenticated, but the address is not being attached to the query:

Moralis.Web3API.account.getNFTs({}).then((a) => console.log(a))

Complains that address is needed.

If I run this first:


Then it works, the address is being attached automatically, but this means that the user needs to click authenticate 2 times(Which is not a good ux).

What am I doing wrong?

(I am very new to this project, I have tried my best to read through the documentation, which is great but for react specifically, I could not find much. It would be very helpful if there is example moralis react repo that get balances etc)

Hi, you can try to look at this code that uses react and Moralis:

Exactly what I needed. Thankyou :facepunch:

1 Like