In this episode, we dive into one of the core aspects of building web apps: linking between pages! We start by adding a basic navigation menu at the top of our app, making it easy to jump between the homepage and our new to-dos page. To keep things simple, we use an unordered list with links in it—nothing too fancy just yet!
You'll see the difference between traditional anchor <a>
tags (which reload the page) and using the NuxtLink
component, which handles navigation the right way in single-page apps by avoiding page reloads. We set up links using route names, which helps keep everything clean and maintainable—plus, we talk a bit about how Nuxt generates those route names automatically based on your file structure.
To cement what we've learned, we also add a 'create to-do' page, hook it into the navigation, and cover the naming pattern Nuxt uses for sub-pages (hint: it uses hyphens in route names when a file isn't called index
). You’ll see how easy it is to link to deeper pages, and even look at a neat shortcut for linking by path.
Finally, we clean up the extra examples, review what we've built, and tease the next episode where we'll get into more dynamic routing—like linking to specific to-do items using URL parameters. By the end of this session, you'll feel confident setting up navigation in your Nuxt app!