UNPKG

@livelike/react-native

Version:

LiveLike React Native package

22 lines (18 loc) 539 B
import { useCallback } from 'react'; import { useAnalytics } from './useAnalytics'; export type UseWidgetInteractedAnalyticsArgs = { widgetId: string; }; export function useWidgetInteractedAnalytics({ widgetId, }: UseWidgetInteractedAnalyticsArgs) { const { trackEvent } = useAnalytics(); return { trackWidgetInteractedAction: useCallback( <T>({ interactionItem }: { interactionItem: T }) => { trackEvent('Widget Interacted', { widgetId, interactionItem }); }, [widgetId, trackEvent] ), }; }