Skip to main content

useBurnNFT

Hook for burning a NFT on a smart contract.

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

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

Usage

Provide your NFT collection contract as the argument.

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

// Your smart contract address
const contractAddress = "{{contract_address}}";
// The tokenId of the NFT you want to burn
const tokenIdToBurn = 1;

function App() {
const { contract } = useContract(contractAddress);
const { mutateAsync: burnNft, isLoading, error } = useBurnNFT(contract);

return (
<Web3Button
contractAddress={contractAddress}
action={() =>
burnNft({
tokenId: tokenIdToBurn,
})
}
>
Burn NFT
</Web3Button>
);
}