showing results for - "next js navigation to other page in a function"
Violette
28 Jun 2019
1import { useRouter } from 'next/router'
2
3function Home() {
4  const router = useRouter()
5
6
7  const handleClick = e => {
8    e.preventDefault()
9    router.push('/some-path')
10  }
11
12  return (
13    <button type="button" onClick={handleClick}>
14      Go Somewhere
15    </button>
16  )
17}
18
19