mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-06 14:31:57 +08:00
Merge pull request #24523 from p-jackson/link-inner-ref
react-router-dom: Add `innerRef` prop to <Link> component
This commit is contained in:
2
types/react-router-dom/index.d.ts
vendored
2
types/react-router-dom/index.d.ts
vendored
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/ReactTraining/react-router
|
||||
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
|
||||
// Huy Nguyen <https://github.com/huy-nguyen>
|
||||
// Philip Jackson <https://github.com/p-jackson>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
@@ -44,6 +45,7 @@ export class HashRouter extends React.Component<HashRouterProps, any> {}
|
||||
export interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
||||
to: H.LocationDescriptor;
|
||||
replace?: boolean;
|
||||
innerRef?: (node: HTMLAnchorElement | null) => void;
|
||||
}
|
||||
export class Link extends React.Component<LinkProps, any> {}
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@ import * as React from 'react';
|
||||
import {
|
||||
NavLink,
|
||||
NavLinkProps,
|
||||
match
|
||||
match,
|
||||
Link
|
||||
} from 'react-router-dom';
|
||||
import * as H from 'history';
|
||||
|
||||
@@ -19,3 +20,8 @@ export default function(props: Props) {
|
||||
<NavLink {...rest} isActive={isActive}/>
|
||||
);
|
||||
}
|
||||
|
||||
<Link to="/url" />;
|
||||
|
||||
const acceptRef = (node: HTMLAnchorElement | null) => {};
|
||||
<Link to="/url" replace={true} innerRef={acceptRef} />;
|
||||
|
||||
Reference in New Issue
Block a user