npx create-react-app
<div className="aaa"></div>
<>
</>
<div>
{
(1+1 ===2) ? (<p>정답</p>) : (<p>오답</p>)
}
</div>
const posts = [
{id:1, title:"hello", content:"welcome!!"},
{id:2, title:"installation", content:"npm method"}
];
function Blog(){
const content = posts.map((post) =>
<div key={post.id}>
<h3>{post.title}</h3>
<h3>{post.content}</h3>
</div>
);
return (
<div>
{content}
</div>
);
}
컴포넌트
하나의 기능 구현을 위해 묶어놓은 여러코드의 묶음 .
UI를 구성하는 필수요소임.
리액트 어플리케이션은 컴포넌트들의 관계를 트리 구조로 형상화 하여 표현이 가능