Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the advantage of using nuxt-link over router-link?

In Nuxt, we can use router-link as well as nuxt-link. What is the advantage of using nuxt-link over router-link?

<nuxt-link to="/about">About</nuxt-link>

instead of

<router-link to="/about">About</router-link>
like image 978
Nilanshu Jaiswal Avatar asked Jun 23 '20 20:06

Nilanshu Jaiswal


People also ask

What does Nuxt link do?

This component ( <nuxt-link> ) is used to provide navigations between page components and enhance performances with smart prefetching.

What is the benefit of Nuxt?

It simplifies the development of universal or single page Vue apps. Nuxt. js abstracts away the details of server and client code distribution so you can focus on application development. The goal with Nuxt is for it to be flexible enough for you to use as a main project base.

Does Nuxt support Vue-router?

Nuxt ships with Vue and many popular Vue libraries such as vue-router for routing, vuex for global state management, and vue-meta for meta tags handling. Also, Nuxt is very versatile. We can use Nuxt for building single-page apps (SPAs), dynamic SSR, and static site generation (SSG).


1 Answers

According to Nuxt Docs, two important points:

This component (<nuxt-link>) is used to provide navigations between page components and enhance performances with smart prefetching.

In fact, <nuxt-link> extends <router-link>. That means it takes the same properties and can be used in the same manner.

After that we can read about smart prefetching:

Nuxt.js will automagically prefetch the code-splitted pages linked with when visible in the viewport by default. This hugely improves the end user performances.

Based on that I think you are simply looking at better performance with <nuxt-link>.

like image 143
Jakub A Suplicki Avatar answered Sep 28 '22 03:09

Jakub A Suplicki