From the course: Master Next.js: Elaborate Hands-On Web Development, React Basics, Advanced Next.js, and Deployment

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Prefetching and codesplitting with Link and CSN – client-side navigation in Next.js

Prefetching and codesplitting with Link and CSN – client-side navigation in Next.js

From the course: Master Next.js: Elaborate Hands-On Web Development, React Basics, Advanced Next.js, and Deployment

Prefetching and codesplitting with Link and CSN – client-side navigation in Next.js

Okay, so we built this first post, but the problem is if we're at our homepage, localhost 3000 on the index, how can we actually get from here to there or to get from there back to here, right? So that's what a link component would do. And in order to do linking, we use the A tag in HTML. And with Next.js, we can use the link component with next link. And that can just help us link between our pages. And the link allows us to do client side navigations. It also accepts props, so you just get better control over the navigation behavior as a whole. How do we actually use link? Well, let's go back to the localhost 3000 page, for example. We see, let's get this party started, get started by editing over here. What we could do is we can remember how we had an A tag wrapped around here and it was breaking, so I had to delete it because I deleted half of it. Well, instead of wrapping it around an A tag, why don't we wrap this let's get this party started or whatever your welcome messages…

Contents