: 서버에서 렌더링되고 요청되는 컴포넌트
서버와 클라이언트 (브라우저)가 리액트 애플리케이션을 서로 협력하여 렌더링 할 수 있다

https://pyjun01.github.io/v/rsc/
RSC는 기존의 React Tree는 그대로 두고 React Tree이전에 미리 서버에서 실행되는 server layer를 추가했다.
트리의 일부 컴포넌트는 서버에서 렌더링하거나, 일부 컴포넌트는 브라우저에서 렌더링 하는 등 처리를 할 수 있다
Zero Bundle 사이즈 컴포넌트
Server Component는 HTML 자체를 반환하기보다는, 렌더링된 UI에 대한 설명을 반환
각각의 컴포넌트마다 Client 컴포넌트로 렌더할 것인지, Server 컴포넌트로 렌더할 것인지 선택한다
자유로운 서버 리소스 접근 : DB, 파일 시스템 같은 서버 사이드 데이터 소스에 접근 가능
JSON.stringify: 직렬화를 수행 ↔ JSON.parse : 역직렬화를 수행자동 Code Splitting
Code Splitting : 하나의 번들 파일을 여러 개의 번들 파일로 나누는 것
RSC에서 import되는 모든 RCC를 code splitting포인트로 간주하기에 React.lazy를 명시하지 않아도 됨
기존 Client Component에서 구현하기 위해서는 React.lazy와 dynamic import 적용
// PhotoRenderer.js
// NOTE: *before* Server Components
import React from 'react';
// one of these will start loading *when rendered on the client*:
const OldPhotoRenderer = React.lazy(() => import('./OldPhotoRenderer.js'));
const NewPhotoRenderer = React.lazy(() => import('./NewPhotoRenderer.js'));
function Photo(props) {
// Switch on feature flags, logged in/out, type of content, etc:
if (FeatureFlags.useNewPhotoRenderer) {
return <NewPhotoRenderer {...props} />;
} else {
return <OldPhotoRenderer {...props} />;
}
}
Progressive Rendering
getServerSideProps, getStaticProps 미사용