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.
import { useNFTs } from "@thirdweb-dev/react";
const { data, isLoading, error } = useNFTs(contract);
Usage
Provide your NFT collection contract from the useContract
hook as an argument to the hook.
import { useNFTs, useContract } from "@thirdweb-dev/react";
// Your smart contract address
const contractAddress = "{{contract_address}}";
function App() {
const { contract } = useContract(contractAddress);
const { data, isLoading, error } = useNFTs(contract);
}