javascript中的异步/等待循环

我有一个React组件,可以在组件安装时运行此功能。

 function getListOfItems(){
    let result = [];
    for(let i=0 ; i<5 ; i++){
        /**
         * code to assign values to some variables namely param1,param2
         */
        getDetails(param1,param2);
    }
    const getDetails = async (param1,param2) => {
        let list = await getAPIresults(param1)
        result.push(list);
        if(result.length === 5){
            //code to update a hook which causes render and displays the text in results array
        }
    }
 }
  
 useEffect(() => {
   getListOfItems()
 },[])

因此,代码正在运行,但结果数组具有随机顺序的数据。例如,结果数组可能看起来像这样[2,5,1,3,4],在这里我希望它看起来像这样[1,2,3,4,5],这意味着上面的代码未运行异步任务按其到达顺序排列。所以有人可以帮我解决这个问题,我希望代码按到达的顺序发出异步请求。