I have used the async function and waiting for one API to hit and display its current file name which got uploaded then increase the counter I and go for the next file.
ISSUE: The async and await is working fine but the callbacks are called after all the requests have been made.
How can I hit the API and get its name printed then go for another file to hit the API?
PS: I can't change callback to promise, it's a defined structure in my organization as of now.
Code:
uploadCallback = () => {
  console.log(currentFile)
}
const loop = async() => {
  for (let i = 0; i < this.state.fln.length; i++) {
    currentFile = obj.fln;
    await uploadAPI(obj, this.uploadCallback);
    console.log('currentFile:', i, currentFile);
  }
}; 
     
     
    