title: returning undefined for the function in spfx react
body: <p>tried cascading drop down using 2 columns. but it keeps returning undefined. unable to setState in dropdown function</p>
  <p>the values are returning in console, but not able to set the state</p>
  <pre><code>    private async test(getVal: any):promis&lt;void&gt; {
      ...
      
      var timePeriod = this.dropdown(getval.key);
      log(timePeriod)
      //returns undefined
      }
      
      public dropdown(val: string){
      sp.web.lists.getbytitle(&quot;&quot;).items.select(&quot;&quot;).filter(&quot;&quot; + val + &quot;'&quot;).getAll().the(function (data){
      log(data)
      for(var k in data){
      timePeriod.push({key:data[k].period, text: data[k].Period})
      }
      
      retur data;
      }
      
      )
      }
  </code></pre>