mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
25 lines
685 B
TypeScript
25 lines
685 B
TypeScript
import * as H from 'history';
|
|
import * as React from 'react';
|
|
import { match } from 'react-router';
|
|
import { HashLink, NavHashLink, NavHashLinkProps } from 'react-router-hash-link';
|
|
|
|
interface Props extends NavHashLinkProps {
|
|
extraProp: string;
|
|
}
|
|
|
|
const getIsActive = (extraProp: string) => (match: match<any>, location: H.Location) => !!extraProp;
|
|
|
|
export default function(props: Props) {
|
|
const {extraProp, ...rest} = props;
|
|
const isActive = getIsActive(extraProp);
|
|
return (
|
|
<NavHashLink {...rest} isActive={isActive} />
|
|
);
|
|
}
|
|
|
|
<HashLink to="url" />;
|
|
|
|
const acceptRef = (node: HTMLAnchorElement | null) => {
|
|
};
|
|
<HashLink to="/url" replace={true} innerRef={acceptRef} />;
|