score:1

Accepted answer
componentDidUpdate(prevProps) {
  if (prevProps.match.params !== this.props.match.params) {
    this.getData();
  }
}

score:1

//In your listing component you can pass the getData function in your form component
 constructor(props) {
        super(props);

        this.state = {
            mapLatLng: [],
            listInfo: []
        }
        
        this.getData = this.getData.bind();
}

render () {
        return (
            <div>
                <Form getData={this.getData} />

                <List data={this.state.listInfo} />

                <div className="map-container">
                    <MapList data={this.state.mapLatLng} />
                </div>
            </div>
        )
    }
    
    
  // Then in your form comppnent you can call get data on submit
     <form 
                    name="myForm"
                    autoComplete="off"
                    onSubmit = {(e) => {
                        e.preventDefault();
                        this.props.history.push(`/listing/${sleeps}/${startDate}/${endDate}`);
                        this.props.getData();
                    }}>

Related Query

More Query from same tag