Download wp-calypso/client/dashboard/components/component-view-tracker/index.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 485 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/dashboard/components/component-view-tracker/index.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/dashboard/components/component-view-tracker/index.tsx
-
curl -L -o index.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/dashboard/components/component-view-tracker/index.tsx
485 Bytes
| import { useEffect } from 'react'; | |
| import { useAnalytics } from '../../app/analytics'; | |
| export default function ComponentViewTracker( { | |
| eventName, | |
| properties, | |
| }: { | |
| eventName: string; | |
| properties?: Record< string, unknown >; | |
| } ) { | |
| const { recordTracksEvent } = useAnalytics(); | |
| useEffect( () => { | |
| recordTracksEvent( eventName, properties ); | |
| }, [ recordTracksEvent, eventName, JSON.stringify( properties ) ] ); // eslint-disable-line react-hooks/exhaustive-deps | |
| return null; | |
| } | |