DOCS

useNFTCollection

Hook for getting an instance of an NFTCollection contract. This contract is meant to interface with ERC721 compliant NFTs.

Example

import { useContract } from '@thirdweb-dev/react'

export default function Component() {
  const { contract, isLoading, error } = useContract("<YOUR-CONTRACT-ADDRESS>", "nft-collection")

  // Now you can use the nftCollection contract in the rest of the component

  // For example, this function will return all the NFTs on this contract
  async function getNFTs() {
    const nfts = await contract.getAll()
    return nfts
  }

  ...
}

Parameters

Returns