component 의 가장 중요한 역할은 재사용성에 있다. 따라서 컴포넌트들을 각각의 파일로 분리하여 재사용하기 쉽도록 관리한다.
root component는 모든 컴포넌트 계층의 최상위에 존재하는 컴포넌트의 시작점 이다.
// Gallery.js
export function Profile() {
// ...
}
export default function Gallery() {
return(
<div>
<h1>Gallery</h1>
<Profile/>
<Profile/>
</div>
)
}
// App.js
import Gallery, {Profile} from './Gallery.js';