Skip to main content

useTotalCount

Hook to get the total count of NFTs minted on a smart contract.

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

import { useTotalCount } from "@thirdweb-dev/react";

Usage

Provide your NFT collection contract as the argument.

import { useTotalCount, useContract } from "@thirdweb-dev/react";

// Your smart contract address
const contractAddress = "{{contract_address}}";

function App() {
const { contract } = useContract(contractAddress);
const { data } = useTotalCount(contract);

return <div>Total NFTs: {data?.toString() || 0}</div>;
}