父組件當其他值從新渲染agrestacmb
<Agreement agre={(val) => {agrestacmb={this.state.agrestacmb} />
子組件
componentWillReceiveProps(nextProps,nextContext){
this.setState({
isopened:nextProps.agrestacmb
})
}
component Will Receive Props 即組件將接受props
父組件當其他值從新渲染agrestacmb
<Agreement agre={(val) => {agrestacmb={this.state.agrestacmb} />
子組件
componentWillReceiveProps(nextProps,nextContext){
this.setState({
isopened:nextProps.agrestacmb
})
}
component Will Receive Props 即組件將接受props