diff --git a/lib/link.js b/lib/link.js index ee16d715..130a1c58 100644 --- a/lib/link.js +++ b/lib/link.js @@ -127,7 +127,14 @@ export default class Link extends Component { // This will return the first child, if multiple are provided it will throw an error const child = Children.only(children) const props = { - onClick: this.linkClicked + onClick: (e) => { + if (child.props && typeof child.props.onClick === 'function') { + child.props.onClick(e) + } + if (!e.defaultPrevented) { + this.linkClicked(e) + } + } } // If child is an tag and doesn't have a href attribute, or if the 'passHref' property is diff --git a/test/integration/basic/pages/nav/index.js b/test/integration/basic/pages/nav/index.js index 0a364ddf..07b4578a 100644 --- a/test/integration/basic/pages/nav/index.js +++ b/test/integration/basic/pages/nav/index.js @@ -38,6 +38,7 @@ export default class extends Component { As Path As Path (No as) As Path (Using Router) + A element with onClick