I have this array data from api and I want to make it in react tsx file using map function
{
"data":{
"cart":{
"1":{
"product_id":1,
"name":"Product 1",
"quantity":1,
"price":"1.00"
},
"2":{
"product_id":2,
"name":"Product 2",
"quantity":1,
"price":"1.00"
}
}
}
}
React Typescript Code (but not working):
(data.cart.map((item:any, key:any) => (
<p>{item.product_id}</p>
<p>{item.name}</p>
<p>{item.quantity}</p>
<p>{item.price}</p>
)))
I want to to fix the react tsx code