title: Generic function in react with multiple state variables
body: <p>How to write a generic function with various state variable change based on the dropdown.</p>
  
  <p>for ex:</p>
  
  <p>I have dropdown 1 and dropdown 2. If I change the</p>
  
  <p>dropdown 1, I need to change the few state variables like a, b, c</p>
  
  <p>dropdown 2, I need to change the few state variables like x, y, z</p>
  
  <p>I can do this with 2 functions. But how to write a a generic function for this?</p>
  
  <pre><code>handleChange: function(e) {
      //api call to xyz.com/getcompany/&lt;company id&gt; to get the job list here
      this.setState({
        selectedCompany: e.target.value,
        companychange: "company changed. New value: " + e.target.value
      })
    },
  
    handleChange2: function (e) {
      // api call to xyz.com/jobstatus/&lt;job id&gt; to get the job status\(like how many position available for this job\) here
      this.setState({
        jobchange:"job changed. New value " + e.target.value
      })
    }
  </code></pre>
  
  <p>Codepen: <a href="https://codepen.io/asdhanapal/pen/WmwJPj?editors=0011" rel="nofollow noreferrer">https://codepen.io/asdhanapal/pen/WmwJPj?editors=0011</a></p>