jan/web/app/_helpers/withAnalytics.tsx
2023-10-20 11:29:10 +07:00

16 lines
355 B
TypeScript

'use client'
import React, { useEffect } from 'react'
export function withAnalytics<P extends Record<string, any>>(
Component: React.ComponentType<P>
): React.FC<P> {
const WrappedComponent: React.FC<P> = (props) => {
useEffect(() => {
// Initialize analytics
}, [])
return <Component {...props} />
}
return WrappedComponent
}