Function: useAds()
useAds<
TProduct
>(props
):UseAdsReturn
<TProduct
>
Defined in: useAds.tsx:74
Fetches and returns hydrated ads
It must be used within an AdsProvider component, which supplies the necessary context such as identity and hydration strategy.
Type Parameters
TProduct
TProduct
extends object
Parameters
props
Configuration object for the ad request including placement, type, amount, and optional search parameters
Returns
UseAdsReturn
<TProduct
>
An object containing ads data, loading state, error information, and refresh function
Throws
Will throw an error if used outside of an AdsProvider.
Example
const \{ ads, isLoading, error, refresh \} = useAds(\{
placement: "top",
type: "product",
amount: 3,
term: "camiseta",
selectedFacets: [\{ key: "brand", value: "Nike" \}],
\});