react 父組件傳值從新渲染子頁面

父組件當其他值從新渲染agrestacmb

 <Agreement agre={(val) => {agrestacmb={this.state.agrestacmb} />

子組件

 componentWillReceiveProps(nextProps,nextContext){

        this.setState({

            isopened:nextProps.agrestacmb

        })

    }

 

component Will Receive Props 即組件將接受props

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章