title: How to return array from function in react js
body: <p>Hi i am new to react js i am calling getItem function and pushing response to an array and return array that array but i am getting empty array before i return </p>
  
  <pre><code>  private _LoadExpenses() {
      const items: IExpense[] = [];
      this._expensesDataProvider.getItems().then((expenses: IExpense[]) =&gt; {
          expenses.forEach(element =&gt; {
            items.push({SGDDAppDate:element.SGDDAppDate,ExpenseCategory:element.ExpenseCategory,ExpenseType1:element.ExpenseType1});
         });
          return expenses;
      });
      //console.log(items)
      return items;
    }
  </code></pre>