import * as React from 'react'; import { NavLink, NavLinkProps, match, Link, RouteComponentProps, LinkProps } from 'react-router-dom'; import * as H from 'history'; const getIsActive = (extraProp: string) => (match: match, location: H.Location) => !!extraProp; interface Props extends NavLinkProps { extraProp: string; } export default function(props: Props) { const {extraProp, ...rest} = props; const isActive = getIsActive(extraProp); return ( ); } type OtherProps = RouteComponentProps<{ id: string; }>; const Component: React.FC = props => { if (!props.match) { return null; } const { id } = props.match.params; return
{id}
; }; ; const MyLink: React.FC = props => ; ; ({ ...location, pathname: '/pizza' })} />; ({ ...location, pathname: '/pizza' })} />; const refCallback: React.Ref = node => {}; ; const ref = React.createRef(); ;