However, when I run a console.log(rows), it returns an undefined list.
let rows: Array<{ id: number }> = []
rows = products?.map((product) =>
{ id: product.product_id }
)
Attempting to do it without using map does work, like so:
let rows = [
{id: 1},
{id: 2},
{id: 3},
]
The array "rows" will be utilized in a DataGrid component from material-ui. Thus, I need to populate the array rows using map to keep it consistent with the above array.