프롭스 다양하게 내려주고 쓰는 방법
children 으로 작성한 부분을 주목해 둘 것.
부모
...
return (
<div>
<div>작성자: {currentUser}</div>
<NewTweetForm addfunc = {addNewTweet}/>
<ul id = "tweets">
{tweets.map((t) => {
<SingleTweet key = {t.uuid} writer = {t.writer} date = {t.date}>
{t.content}
</SingleTweet>
})}
</ul>
</div>
)
}
자식
function SingleTweet({writer,date,children}){
return(
<li>
<div>{writer}</div>
<div>{date}</div>
<div>{children}</div>
</li>
)
}