Skip to content

Commit

Permalink
Merge pull request #37 from tordans/patch-1
Browse files Browse the repository at this point in the history
Docs: Improve click tracking example
  • Loading branch information
ai authored May 20, 2024
2 parents 7320b94 + 3975fbd commit 1edba9b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,8 @@ You can disable this behavior by `links: false` options and create custom
export const $router = createRouter({ … }, { links: false })

function onClick (e) {
let link = event.target.closest('a')
if (isPjax(link, e)) {
$router.open(new Url(link.href).pathname)
}
e.preventDefault()
$router.open(new Url(e.target.href).pathname)
}

export const Link = (props) => {
Expand Down

0 comments on commit 1edba9b

Please sign in to comment.