rsnext/docs/routing/imperatively.md
2020-05-27 17:51:11 -04:00

857 B

description
Client-side navigations are also possible using the Router API instead of the Link component. Learn more 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