mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
22 lines
483 B
TypeScript
22 lines
483 B
TypeScript
import * as React from 'react';
|
|
import {
|
|
NavLink,
|
|
NavLinkProps,
|
|
match
|
|
} from 'react-router-dom';
|
|
import * as H from 'history';
|
|
|
|
const getIsActive = (extraProp: string) => (match: match<any>, location: H.Location) => !!extraProp;
|
|
|
|
interface Props extends NavLinkProps {
|
|
extraProp: string;
|
|
}
|
|
|
|
export default function(props: Props) {
|
|
const {extraProp, ...rest} = props;
|
|
const isActive = getIsActive(extraProp);
|
|
return (
|
|
<NavLink {...rest} isActive={isActive}/>
|
|
);
|
|
}
|