Skip to content

Commit ed274a1

Browse files
committed
add onClick in Link
1 parent b574829 commit ed274a1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/link.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export default class Link extends React.Component<Props, State> {
2727
className,
2828
activeClassName,
2929
activeOnlyWhenExact,
30+
onClick,
3031
...rest
3132
} = this.props;
3233
const isActive = Link.isActive(to, this.context.router.getState().location.pathname, activeOnlyWhenExact);
@@ -35,7 +36,7 @@ export default class Link extends React.Component<Props, State> {
3536
<a
3637
{...rest}
3738
href={to}
38-
onClick={this.navigate}
39+
onClick={onClick || this.navigate}
3940
className={isActive ? [className, activeClassName].join(' ').trim() : className}
4041
/>
4142
);

0 commit comments

Comments
 (0)