metaplex-foundation / js-examples

Examples and Starter Kits using the new JS SDK
MIT License
79 stars 92 forks source link

TypeError: nftList.filter is not a function #14

Open jvick1 opened 2 years ago

jvick1 commented 2 years ago

Having issues with Unhandled Runtime Error. TypeError: nftList.filter is not a function. See screenshot below. Any suggestions?

image

jvick1 commented 2 years ago

this is for the paginate all NFTs repo

louieogrady commented 2 years ago

I have the same issue here, seems that nftList is not the correct type?

davidbeard741 commented 2 years ago

This is definitely an issue that needs to be addressed. Especially since this is supposed to be a gateway for early developers.

I believe the issue is that a basic JavaScript fundamental, .filter cannot be applied to an objects. However, I would need to double check this via a console check.

If this is the issue, change object into an array using Object.entries().

muygur commented 2 years ago

hey, we have the same issue, please help us

wooddyy-sol commented 1 year ago

If I had to guess, this issue arises from this line.

const [nftList, setNftList] = useState(null);

try changing it to

const [nftList, setNftList] = useState([]);