import { useCallback , MouseEvent } from 'react' ; import { useRouter } from 'next/router' ; export function useNavigateToUrl ( ) { const { push } = useRouter ( ) ; return useCallback ( ( url , event ) => { if ( event . metaKey || event . ctrlKey ) { window . open ( url ) ; } else { void push ( url ) ; } } , [ push ] ) ; }