Hi All
Iām new to Javascript & React.
Iām building an application that gets metatata (name, description, image) of an NFT.
Using the getNFTs() code found here in a useEffect hook like this
const [nft, setNft] = useState([]);
useEffect(() => {
async function getNft() {
const options = {
chain: "chain",
address: "walletaddress",
token_address: "tokenaddress"
};
const polygonNFTs = await Web3Api.account.getNFTs(options);
setNft(polygonNFTs.result.map(item => {
return item.metadata
}))
}
getNft()
}, [])
I get the correct metadata back as an array of objects. But I canāt seem to be able to map through it (nft) to display the name, description and image.
I get āCannot read properties of undefinedā or āCannot read properties of nullā
I would appreciate if anyone could point me in the right direction.
Thanks in advance