//@flow import * as React from "react"; import {Link, Route} from "react-router-dom"; // TODO mostly copy of PrimaryNavigationLink type Props = { to: string, icon?: string, label: string, activeOnlyWhenExact?: boolean, activeWhenMatch?: (route: any) => boolean }; class NavLink extends React.Component { static defaultProps = { activeOnlyWhenExact: true }; isActive(route: any) { const { activeWhenMatch } = this.props; return route.match || (activeWhenMatch && activeWhenMatch(route)); } renderLink = (route: any) => { const { to, icon, label } = this.props; let showIcon = null; if (icon) { showIcon = (<>{" "}); } return (
  • {showIcon} {label}
  • ); }; render() { const { to, activeOnlyWhenExact } = this.props; return ( ); } } export default NavLink;