useNFTs

Hook to query all NFTs associated with a smart contract.

Available to use on smart contracts that implement the ERC721 or ERC1155 standard.

NFT metadata is automatically fetched from where the tokenUri is hosted (e.g. IPFS), and makes the image property available as a URL through our IPFS gateway (if the image is hosted on IPFS).

By default, only returns the first 100 NFTs in the collection. You can use the queryParams argument to filter the NFTs that are returned or to paginate through the collection.

Example

import { useNFTs, useContract } from "@thirdweb-dev/react";
function App() {
const { contract } = useContract(contractAddress);
const { data, isLoading, error } = useNFTs(contract);
}
function useNFTs(
contract: RequiredParam<TContract>,
queryParams?: {},
): UseQueryResult<Array<NFT>, unknown>;

Parameters

Instance of a NFTContract

Type

let contract: RequiredParam<TContract>;

By default, the hook will return the first 100 NFTs associated with the contract.

You can use the queryParams argument to paginate the NFTs that are returned.

Returns

let returnType: UseQueryResult<Array<NFT>, unknown>;

Query result object that includes an array of NFT objects