/
mustreets
/
CreateTransactions
Обзор
Документация
Войти
/
mustreets
/
CreateTransactions
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
libJS/hooks/useReporting.ts
23 строки
639 B
Slava
Initialize project with essential configurations and structures
14 май 2026, 22:23
14 май 2026, 22:23
a89cd26
Код
Авторство
О чём код?
import { useCallback, useEffect } from "react"; import { reporter } from "../services/Reporting"; export const useReporting = (componentName: string) => { useEffect(() => { reporter.log(`${componentName} mounted`); reporter.track("view_component", { name: componentName }); return () => { reporter.log(`${componentName} unmounted`); }; }, [componentName]); const trackAction = useCallback( (actionName: string, data?: Record<string, unknown>) => { reporter.track(`${componentName}_action`, { action: actionName, ...data }); }, [componentName], ); return { reporter, trackAction }; };