import * as React from 'react'; import { useHistory } from 'react-router-dom'; interface IPermaLink extends Pick, 'dangerouslySetInnerHTML'> { className?: string, href: string, title?: string, to: string, } const Permalink: React.FC = (props) => { const history = useHistory(); const { className, href, title, to, children, ...filteredProps } = props; const handleClick = (event: React.MouseEvent) => { if (event.button === 0 && !(event.ctrlKey || event.metaKey)) { event.preventDefault(); history.push(to); } }; return ( {children} ); }; export default Permalink;