import { useParams } from 'react-router-dom'; export const useUrlId = (): string | undefined => { const { id } = useParams<{ id?: string }>(); return id; };