Dynamic import Nextjs sample.

Let's start with a simple lazy require example of a react component

It supposes to load the bundle of this component only after you click the button. You can follow the loading on the network tab on dev tools.

Usage:

This component is loaded with the page separated from the bundle and its SSR friendly:

Then you can check on source code (CTRL + U) for it, search for this entire sentence, or even "Viago is going to party" which is the image's alt.

Viago is gonna party
Usage: