I'm learning to use navigation, I have an order page and an order_detail page on the order page, I create an input form, and I collect the input before it is contributed to the order_detail page
and this is the order page:
ongNavigationDetail = ()=>{
let params = {
origin: this.state.selectOrigin.id_origin,
destinasi_sub_city : this.state.selectSubDestinasi.id_kecamatan
}
// console.log(params)
this.props.navigation.navigate('orderdetail',{data:params})
}
in the ongNavigationDetail function, I store the input results into one variable, namely params. consol log results
{"destination_sub_city": "1", "origin": "39"}
and on the order detail page, I want to take the input results from the order page and enter it into the url
page order_detail :
constructor(){
super();
this.state = {
results: [],
}
}
componentDidMount(){
this.cekData();
}
cekData= () =>{
let params = this.props.data; //the results of my order page input here
const url = 'https://example/price?id_origin=${1}&id_destinasi=${39}'
fetch(url)
.then((response)=> response.json())
.then((responseJson)=>{
this.setState({
results: responseJson.data.jenis,
isLoading : false
})
}
the question is how to take input parameters on the order page using state and I enter the URL? here url I use manual values
thanks :)