This commit is contained in:
Huy Nguyen
2017-04-06 20:21:01 -04:00
parent b80da73f63
commit 121342e175
2 changed files with 23 additions and 1 deletions

View File

@@ -0,0 +1,21 @@
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}/>
);
}

View File

@@ -13,6 +13,7 @@
"noEmit": true
},
"files": [
"index.d.ts"
"index.d.ts",
"react-router-dom-tests.tsx"
]
}