const Parent = () => {
return (
<Child attribute={value} />
}
}
const Child = (props) => {
return <div>{props.attribute}<div>
}
JavaScript
복사
const Tweets = () => {
const handleRemoveClick = (id) => {
...
}
return (
<Tweet tweet={tweet} handleRemoveClick={() => handleRemoveClick(tweet.id)}>
// <Tweet tweet={tweet} handleRemoveClick={handleRemoveClick}>
)
}
const Tweet = ({tweet, handleRemoveClick}) => {
return <button onClick={handleRemoveClick}></button>
// return <button onClick={() => handleRemoveClick(tweet.id)}></button>
}
JavaScript
복사