title: sending ajax request with state data when state changes
body: <p>I have a react component, In which I am using a <strong>date picker</strong>. Based on value of <strong>Date</strong> selected I am sending an ajax request to fetch data.
  I am not using any frameworks like redux or flux.</p>
  
  <pre><code>export default class MyComponent extends Component {
      constructor(props) {
          super(props);
      }
  
      componentDidMount() {
          // Initial fetch request based on the default date
      }
  
      onDateSelectionChanged(fromDate, toDate) {
          this.setState({
              fromDate,
              toDate
          });
      }
  
      render() {
          return (
              &lt;div className="row"&gt;
                  &lt;DateRangePicker callBackParent = {this.onDateSelectionChanged}/&gt;
                  {/* other stuff */}
              &lt;/div&gt;
          );
      }
  }
  </code></pre>
  
  <p>Now suppose I changed the date to another date. What is the best way to fetch the data again? should I fire request again in<code>onDateSelectionChanged</code> or is there any life-cycle method?</p>