Note: You are viewing the new Next.js documentation. The old docs are still available here.

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 Router API documentation.

The following example shows the basic usage of the Router API:

import Router from 'next/router'

function ReadMore() {
  return (
    <div>
      Click <span onClick={() => Router.push('/about')}>here</span> to read more
    </div>
  )
}

export default ReadMore