Client Component とは?
client component はブラウザで動作するよう明示的にマークされたコンポーネントで、その JavaScript はダウンロードされて実行されます。ローカルな state を保持し、effect を実行し、event handler を付与できますが、これらは server component にはできません。その代償として、bundle のサイズと、インタラクティブ性に必要な hydration が発生します。
なぜ重要か
client component はページに必要なインタラクティブ性を提供しますが、一つ増えるごとにブラウザが読み込む JavaScript も増えます。本当にインタラクティブな部分だけに限定することで、bundle をスリムに保てます。
関連ガイド
What Is a Server Component?A server component renders only on the server, sending its result to the client without shipping its own Java…
What Is Optimistic UI?Optimistic UI updates the interface at once as if an action succeeded, before the server confirms, then recon…
What Is a Suspense Boundary?A suspense boundary wraps part of a UI so that while its data or code is loading, a fallback is shown, lettin…