• M
    Allow onClick on next/link component's child (#4474) · 66922526
    Michał Miszczyszyn 提交于
    Allow `onClick` on `next/link` child. This should not be a breaking change, but it's a very useful feature. Real-life use cases include: analytics or closing menu on navigation, and other.
    
    - [x] allow optional `onClick` on `next/link` component's child
    - [x] call original `child.props.onClick(e)` before `this.linkClicked(e)`
    - [x] add integration tests
    - [x] cancel the navigation if `e.defaultPrevented === true`
    
    Fixes #1490
    66922526
index.js 2.2 KB