score:0

Accepted answer

you cannot call map on each order item as it is an object. to iterate over them use object.entries method.

try like below

{
    orders?.map((order, idx) =>
        object.entries(order).map(
            ([key, { description, title, price, cartquantity }]) => {
                if (key !== "_id") {
                    return (
                        <tr>
                            <td>{key}</td>
                            <td>{title}</td>
                            <td>{price}</td>
                            <td>{cartquantity}</td>
                            <td>{description}</td>
                            <td>email</td>
                            <td>address</td>
                        </tr>
                    );
                }
            }
        )
    );
}

i also noticed your array has stored values with string keys (email, _id). to retrieve them you can do it like below.

{orders?.["email"]}
{orders?.["_id"]}

code sandbox

score:0

is data type array??

    useeffect(() => {
    fetch(`https://polar-savannah-40370.herokuapp.com/dashboard/orders`)
        .then(res => res.json())
        .then(data => setorders(data))
}, [user.email])

Related Query

More Query from same tag