I found a solution to push elements to an array state (Push method in React Hooks (useState)?)
But as you see below, setTheArray is inside a callback. So the order of theArray depend of the callback time.
How to preserve order of theArray based on service_months's order ?
useEffect(() => {
for (const service_month of service_months) {
GET(`/api/report/${props.user_id}`, service_month, resp => {
setTheArray(oldArray => [...oldArray, resp.data])
})
}
}, [service_months])