Next.JS “Link” vs “router.push()” vs “a” tag

router.push

router.push('/push') behaves similarly to window.location. It does not create a <a> tag, which means – if you are concern with SEO, your links will not be detected by crawlers.

<Link>

However, <Link> will create a <a> tag, which means your links will be detected when crawlers scrape your site. Endusers will still navigate with without reloading the page, creating the behavior of a Single Page App.

<a>

<a> tag without using next/link’s <Link> creates a standard hyperlink which directs end user to the url as a new page. (standard behavior).

You should be using <Link> throughout all your website, and use router.push for places where you need redirect in order to retain the behaviour of a Single Page App.

Leave a Comment