1.通過(guò)給子組件加不同的key
<Son key = { Math.random() } />
2.改變父組件給子組件的Props设拟,然后子組件里面調(diào)用
componentWillReceiveProps (currentPoprs, nextProps) {
this.setState ( {
// update your state
})
}
1.通過(guò)給子組件加不同的key
<Son key = { Math.random() } />
2.改變父組件給子組件的Props设拟,然后子組件里面調(diào)用
componentWillReceiveProps (currentPoprs, nextProps) {
this.setState ( {
// update your state
})
}