From the course: React: Server-Side Rendering

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Code splitting in Next.js

Code splitting in Next.js - React.js Tutorial

From the course: React: Server-Side Rendering

Start my 1-month free trial

Code splitting in Next.js

- [Instructor] So you may be wondering, what is this code splitting thing that you heard about, and what are the benefits, and how does a library like Next.js support that? So code splitting, in a nutshell, is the ability to split your code in smaller bundles so the application can load faster when rendered. It's all about speed. Normally, with some libraries, you'd have to be explicit about which part of your application you want to be bundled together. But with Next.js, that's not the case. It comes with code splitting out of the box, and it's pretty intelligent about deciding which part of your code should be split. Off the shelf, Next.js splits your code into components, or whatever is in your page's directory and its' imports. So for example, if you have a page component that imports a CSS file, a dependency, then it will bundle all these three together into its own bundle. There are also advanced features, like…

Contents