react the page jump parameter by value

A page is transmitted to the B page parameters:

A page code as follows:

Event Method toOrderDetail ()

toOrderDetail (item) {

  //this.props.navigation.push ( 'jump target page', {Parameter name: Parameter Value})

  this.props.navigation.push('B', { order_id: item.order_id })

}

Receiving parameter code page B as follows:

In the process life cycle componentDidMount

componentDidMount() {
  alert ( 'previous page pass over the parameters:' + this.props.navigation.state.params.order_id)
  
  this.setState({
            order_id:this.props.navigation.state.params.order_id
        })
}
 
 

Guess you like

Origin www.cnblogs.com/james-L/p/11906903.html