I have the below Axios call
 getDetail = () => {
    this.apiGetDetail
      .callApi(description)
      .then(data => {
          return(data.data);
      })
      .catch(error => {
        console.log("Failed");
      });
  };
When I get the returned value from getDetail function, it ends up being undefined every time. I tried to create a variable make value equal to data and return that but that didn't work either. Always it seems to be getDetail gets completed before apiGetDetail API call and return nothing. I attempted to send the data that's returned to the Redux store or local state but that didn't work for React Table set up I have either.
I have below subComponent for the React Table
        SubComponent={row => {
            let myDetail = this.getDetail(
              row.original.cusip,
              row.original.description,
              detailColumns
            );
             return (
              <ReactTable
                data={Array.from(myDetail)}
                columns={detailColumns}
                style={{ height: "400px" }}
                minRows="5"
                noDataText="No Data"
              />
            );
          }}
but it can't be displayed because data comes back as empty.
How can I make sure within getDetail function to wait apiGetDetail call to be returned then return the data value that comes from that??
Edit: I am sure this can be done using async await but I don't know how I can apply that to this set up. I've never done async await before...
 
    