Skip to content
Advertisement

How do I map an through an array of objects and display each object individually? I want each pizza order to show

I am not sure how to iterate through each order and show them as individual orders. The api response looks like this…

0:

Crust: “THIN”

Flavor: “CHEESE”

Order_ID: 2

Size: “S”

Table_No: 5

Timestamp: “2019-12-03T18:21:08.708470”

And can go on to have as many orders as possible. I do not need the Order_ID showing so maybe that is a way to iterate through?

JavaScript

Advertisement

Answer

From what I could figure out from your codeblock, this should work. Just set the orders array to the response.data and then iterate over the orders array in your render function.

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement