This hook makes a request to fetch metadata from IPFS retrieved from the zNFT `metadataURI`. Most IPFS servers allow remote JSON fetches, including all Zora NFTs. There is a chance this request could fail when the server does not allow cross-origin requests. Requests are set with a 10 second timeout to allow showing the user an error message instead of an indefinite loader. Metadata information can be found in the [zora metadata schema repo](https://github.com/ourzora/media-metadata-schemas). Metadata validation can be ignored optionally by passing in a second argument `{allowInvalid: true}`, otherwise, an error will be thrown for invalid metadata. Hook result type: ```ts type useNFTMetadataType = { error?: string; // Error: can be thrown from invalid json, unparsable json, network request failure, network request timeout loading?: boolean; // Easy indicator to determine if the NFT metadata is loading. Same as (!metadata && !error). metadata?: any; // Raw, validated zora metadata. A error will be thrown if the metadata does not validate. }; ``` To use the hook, simply pass in the URL to fetch: ```ts import { useNFTMetadata } from "@zoralabs/nft-hooks"; const MediaDataDisplay = ({ uri: string }) => { const { error, metadata } = useNFTMetadata(uri); if (metadata) { if (metadata.version === "catalog-20210202") { return (
{metadata.body.notes}
}{metadata.description}