I'm trying render Child Component by Click event from Parent Component. This is the Parent Component. I choose a start date and end date in Parent Component.
handleStartDateChange = (e, date) => {
this.setState({ startDate: date });
}
...
handleFilterClick = () => {
let urlGetCashListByDate = urlGetCashList + '?starttime=' + this.state.startDate +'&endtime=' + this.state.endDate;
let urlGetOrderListByDate = urlGetOrderList + '?starttime=' + this.state.startDate + '&endtime=' + this.state.endDate;
}
render() {
return (
<DatePicker
id="start-date"
onChange={this.handleStartDateChange}/>)
<DatePicker
id="end-date"
hintText="End Date"
onChange={this.handleEndDateChange}/>
<RaisedButton
onClick={this.handleFilterClick}/>
<OrderList/>
<CashList/>
)}
Here is Child Component:
class OrderList extends Component{
componentDidMount(){
this.props.getOrderList(urlGetOrderList);
}
And CashList child Component:
class CashList extends Component{
componentDidMount(){
this.props.getCashList(urlGetCashList);
}
How can I render Child Component with new Url of Parent Component like this? (in CashList Component)
this.props.getCashList(urlGetCashListByDate)
I know passing a state, but my problem is url. Thank you.