๐ฏ Poin-Poin Utama Modul Ini:
- Komponen
<Image>otomatis mengubah format ke AVIF/WebP, resizing, & mencegah Layout Shift (CLS) next/fontmengunduh Google Fonts secara otomatis saat waktu build (Zero Cumulative Layout Shift)dynamic()untuk Lazy Loading komponen berat berbasis Client
๐ Teknik Optimasi Performa Next.js 16
Next.js menyediakan komponen optimasi otomatis untuk memastikan skor Google Lighthouse (LCP, CLS, INP) mencapai hasil terbaik.
๐ป Contoh Lazy Loading dengan dynamic()
components/EventMap.tsx
import dynamic from "next/dynamic";
// Memuat komponen peta berat hanya di sisi client saat dibutuhkan
const LeafletMap = dynamic(() => import("@/components/LeafletMap"), {
ssr: false,
loading: () => <p>Memuat Peta...</p>,
});
export default function EventLocation() {
return <LeafletMap />;
}