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.

What is code splitting in Next.js?

What is code splitting in Next.js?

OK, let's take a look at code splitting. Let's discuss code splitting, the next very important optimization that Next.js offers. Developers, what we do is we commonly divide our applications into different pages, as we're going to see when we develop our app together. We're going to make a blog app. We're going to have different pages for it. And all these pages need to be accessible through different endpoints or URLs. And that should make sense intuitively, right? When you go to a website and you click on something, it's going to take you to a different link under the same domain, and then you have different endpoints. So these pages essentially act as unique entry points into the application in that way. And this is where code splitting comes in, because code splitting involves fragmenting the applications bundle into smaller segments required by each entry point. If that sounds confusing, just think of it really simply. You have the bundled code, but you take that bundle code Then…

Contents