I have a type that was returned via axios
The proto shows Array, and the typeof shows Object, when I call it via
console.log(allOrderDetails[0])
It returns undefined, how to go around this?
I've tried to loop to each of it by
allOrderDetails.map((item)=> {console.log(item)})
It is not logging a single item, I've also tried logging it by treating it as object
Object.values(allOrderDetails).forEach(value=>{
   console.log(value);
});
Still, is not logging a single item.
I am trying to access the product_id that in theory, supposed to be returned by allOrderDetails[0].product_id, however, allOrderDetails[0] return undefined.
My input obtained is as like this
let allOrderDetails = []
const updateOrderDetails = (values) => {
    allOrderDetails = [];
    let config = {
        method: "get",
        url: "http://localhost:3000/v1/orderdetails/b612z512h1x1",
        headers: {
            Authorization: "Bearer " + token.access.token,
        },
    };
    axios(config)
    .then((response) => {
        allOrderDetails.push(response.data);
    })
};
const printItemName = () => {
    console.log(allOrderDetails);
    console.log(allOrderDetails[0]);
};
return (
    <div>
        {updateOrderDetails()}
        <div style={{ fontFamily: "Segoe UI" }}>{printItemName()}</div>
    </div>
)

