我在父組件里面點擊多次,為什么子組件只會觸發一次componentWillMount,之后就再也沒觸發了,按理來說我click一次就會重新setState一次,完后子組件生命周期會重新開始重置的吧如果我想子組件的componentWillMount每次都會觸發,這個該怎么實現呢//父組件index.jsclick=()=>this.setState({bool:true});//默認falserender(){return(click{this.state.bool?:''})}//子組件Test.jscomponentWillMount(){console.log('...componentWillMount...')}render(){return...Test...}
跪求!關于componentWillMount生命周期的問題 react十分感謝
慕絲7291255
2019-10-08 10:30:36