1import { useRouter } from 'next/router'
2
3export default function Page() {
4 const router = useRouter()
5
6 return (
7 <button type="button" onClick={() => router.push('/about')}>
8 Click me
9 </button>
10 )
11}
12
1import { withRouter } from 'next/router'
2
3class About extends React.Component {
4 // your Component implementation
5 // retrieve them like this
6 // this.props.router.query.name
7}
8
9export default withRouter(About)
10