Component is loaded and hydrated immediately during page load, providing immediate interactivity.
import Component from '../components/Component';
export default function Page() {
return (
<div>
<Component />
</div>
);
}
Component is loaded separately from the main bundle.
import dynamic from 'next/dynamic';
const Component = dynamic(() => import('../components/Component'));
export default function Page() {
return (
<div>
<Component />
</div>
);
}
Component is rendered on the server but only loads and hydrates when enters the viewport.
import { lazyHydrate } from 'next-lazy-hydration-on-scroll';
const Component = lazyHydrate(() => import('../components/Component'));
export default function Page() {
return (
<div>
<Component />
</div>
);
}