useProductMedia
The useProductMedia hook fetches media items (images, videos, etc.) for a specific product.
Anchor to useProductMedia-parametersParameters
- Anchor to paramsparamsparamsUseProductMediaParamsUseProductMediaParamsrequiredrequired
UseProductMediaReturnsUseProductMediaReturns
UseProductMediaParams
- fetchPolicy
DataHookFetchPolicy - first
number - id
The product ID to fetch media for.
string - skip
boolean
DataHookFetchPolicy
'cache-first' | 'network-only'UseProductMediaReturns
- error
Error | null - fetchMore
() => Promise<void> - hasNextPage
boolean - loading
boolean - media
The product media returned from the query.
ProductMedia[] | null - refetch
() => Promise<void>
ProductMedia
{
id: string
image: ProductImage | null
mediaContentType: 'IMAGE'
alt: string | null
} | {
id: string
mediaContentType: 'MODEL_3D'
previewImage: ProductImage | null
sources: {
filesize: number
format: string
mimeType: string
url: string
}[]
alt: string | null
} | {
id: string
mediaContentType: 'VIDEO'
previewImage: ProductImage | null
sources: {
format: string
mimeType: string
url: string
width: number
height: number
}[]
alt: string | null
} | {
id: string
mediaContentType: 'EXTERNAL_VIDEO'
previewImage: ProductImage | null
embedUrl: string
alt: string | null
}ProductImage
- altText
string | null - height
number | null - id
string | null - sensitive
boolean | null - thumbhash
string | null - url
string - width
number | null
Was this page helpful?