import { datadogRum } from '@datadog/browser-rum'; import { FC, useEffect, useRef } from 'react'; import { useLocation } from 'react-router-dom'; import { sanitizeViewName } from './sanitize-view-name'; const useHashRouting = () => { const pathname = sanitizeViewName(useLocation().pathname); const lastPathname = useRef(undefined); useEffect(() => { if (lastPathname.current !== pathname) { datadogRum.startView(pathname); lastPathname.current = pathname; } }, [pathname]); }; export const HashRouting: FC = () => { useHashRouting(); return null; };