js-examples icon indicating copy to clipboard operation
js-examples copied to clipboard

TypeError: nftList.filter is not a function

Open jvick1 opened this issue 3 years ago • 5 comments

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

image

jvick1 avatar Jul 24 '22 00:07 jvick1

this is for the paginate all NFTs repo

jvick1 avatar Jul 24 '22 15:07 jvick1

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

louieogrady avatar Jul 27 '22 20:07 louieogrady

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().

davidbeard741 avatar Aug 15 '22 05:08 davidbeard741

hey, we have the same issue, please help us

muygur avatar Aug 20 '22 23:08 muygur

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

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

try changing it to

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

wooddyy-sol avatar Jan 19 '23 12:01 wooddyy-sol