Skip to main content

Function: AdsProvider()

AdsProvider<TProduct>(props): ReactElement

Defined in: AdsProvider.tsx:49

A React context provider component that supplies ads-related functionality to its child components.

This provider wraps the application or component tree to make ads context available throughout the component hierarchy. It accepts a generic type parameter to ensure type consistency between fetcher and matcher functions.

Type Parameters​

TProduct​

TProduct extends object

Parameters​

props​

AdsProviderProps<TProduct>

The provider props including children, identity, and hydration strategy

Returns​

ReactElement

A ReactNode that provides ads context to its children

Example​

// Type is usually inferred from fetcher/matcher
interface MyProduct \{
id: string;
name: string;
price: number;
\}

const fetcher: ProductFetcher<MyProduct> = // ...
const matcher: ProductMatchesOffer<MyProduct> = // ...

<AdsProvider
hydrationStrategy=\{\{ fetcher, matcher \}\}
// ... other props
>
<MyApp />
</AdsProvider>