Join our community

Get access to the complete guide to developing and deploying fast, production-ready Nuxt apps.

7-5 Lazy Loading Checkout Components

In this lesson, we look at how we can dynamically import components only when they’re needed.

Doing this is as easy as adding the prefix Lazy when rendering a component!

By only loading the checkout components when we click the “Buy” button, we load less code on the initial page load. We also know that not everyone will even click that button, so there’s no point in loading all of that code unless it’s needed.

Lazy Components: https://nuxt.com/docs/guide/directory-structure/components#dynamic-imports

This course was originally built with Nuxt 3, but it's no longer being maintained. You can still follow the lessons, but make sure to use the exact dependency versions listed in the course repository to avoid breaking changes.

If you’re looking for the most up-to-date and fully supported version, we recommend Mastering Nuxt: Full Stack Unleashed , which uses Nuxt 4 and actively being maintained.