rsnext/test/integration/invalid-href/pages/first.js
Joe Haddad 18a9c7e371
Improve linting rules to catch more errors (#9374)
* Update `packages/`

* Update examples

* Update tests

* Update bench

* Update top level files

* Fix build

* trigger
2019-11-10 19:24:53 -08:00

27 lines
573 B
JavaScript

import Link from 'next/link'
import { useRouter } from 'next/router'
const invalidLink = 'mailto:idk@idk.com'
export default () => {
const { query, ...router } = useRouter()
const { method } = query
return method ? (
<a
id="click-me"
onClick={e => {
e.preventDefault()
router[method](invalidLink)
}}
>
invalid link :o
</a>
) : (
// this should throw an error on load since prefetch
// receives the invalid href
<Link href={invalidLink}>
<a id="click-me">invalid link :o</a>
</Link>
)
}