Skip to main content

ThirdwebNftMedia variable

This component can be used to render NFTs from the thirdweb SDK. Props: ThirdwebNftMediaProps

Example

import { ThirdwebNftMedia, useContract, useNFT } from "@thirdweb-dev/react";
export default function NFTCollectionRender() {
const { contract } = useContract(<your-contract-address>);
const { data: nft, isLoading } = useNFT(contract, 0);

return (
<div>
{!isLoading && nft ? (
<ThirdwebNftMedia metadata={nft.metadata} />
) : (
<p>Loading...</p>
)}
</div>
);
}

Signature:

ThirdwebNftMedia: React.ForwardRefExoticComponent<
ThirdwebNftMediaProps & React.RefAttributes<HTMLMediaElement>
>;