class VideoList extends Component {
constructor(props) {
super(props);
this.videoList = props.videos.map((video) => {
return <VideoListItem video={video} />
})
}
render() {
return (
<ul className="collection">
{this.videoList}
</ul>
)
}
}
我只是想知道是否允許我在反應組件中擁有自己的屬性。可以在反應組件中擁有自己的屬性嗎?
感謝您的指導!這個指南可以幫助我很多:) – hytm
也許,我設置'this.videoList'的東西是我可以從道具計算出來的,所以它不應該設置爲狀態。 – hytm