Skip to main content

useNFT() function

This feature is currently in beta and may change based on feedback that we receive.

Use this to get an individual NFT token of your NFTContract.

Example

const { contract } = useContract(<ContractAddress>);
const { data: nft, isLoading, error } = useNFT(contract, <tokenId>);

Signature:

export declare function useNFT<TContract extends NFTContract>(
contract: RequiredParam<TContract>,
tokenId: RequiredParam<BigNumberish>,
): import("@tanstack/react-query").UseQueryResult<NFT, unknown>;

Parameters

ParameterTypeDescription
contractRequiredParam<TContract>an instance of a NFTContract
tokenIdRequiredParam<BigNumberish>the tokenId to look up

Returns:

import("@tanstack/react-query").UseQueryResult<NFT, unknown>

a response object that includes the metadata for the given tokenId