2
我有一個是這樣寫的無狀態組件比較PARAM每次家長呈現
//stateless component
const ComponentOne = ({ month }) => {
console.log(month); // print incremental of 1 when I render parent component
}
,月從其父母傳給一個無狀態的組件。
render(){
return(
<ComponentOne month={ month }/>
)
}
它它的父母我可以改變月份並將其傳遞下去。如何在每次父母呈現後檢查月份是否有所不同?使用componentWillRecieveProps?但是這個組件是一個無國籍的組件。