Imperatively

Examples

next/link should be able to cover most of your routing needs, but you can also do client-side navigations without it, take a look at the documentation for next/router.

The following example shows how to do basic page navigations with useRouter:

  1. import { useRouter } from 'next/router'
  2. export default function ReadMore() {
  3. const router = useRouter()
  4. return (
  5. <button onClick={() => router.push('/about')}>
  6. Click here to read more
  7. </button>
  8. )
  9. }