useNFTContent
Hook to fetch and load the content uri of a NFT. Either returns the uri to fetch or the content that is contained in the uri in the case of text posts.
// This is a union type meaning one or another in typescript.
// Use the (media.type) to determine which type was returned from the hook.
type MediaContentType =
| {
uri: string; // URI of content to render, used for media
type: 'uri', // Shows that no content was downloaded, should only render
mimeType: string // mime type string from metadata for rendering
}
| {
text: string; // Text of result
type: 'text', // Shows that text content to render was downloaded
mimeType: string // mime type string from metadata for rendering
};
type useNFTContentType = {
loading: boolean; // If loading from the server
error?: string; // Error returned from network request error or timeout
content?: MediaContentType; // MediaConetentType shown above;
}Last updated
Was this helpful?