@yext/search-ui-react
Version:
A library of React Components for powering Yext Search integrations
14 lines (11 loc) • 370 B
text/typescript
import { AnalyticsService } from '@yext/analytics';
import { createContext, useContext } from 'react';
export const AnalyticsContext = createContext<AnalyticsService | null>(null);
/**
* Returns a service that can be used to report analytics events.
*
* @public
*/
export function useAnalytics(): AnalyticsService | null {
return useContext(AnalyticsContext);
}