In this simple function data.images is showing undefine but I know it not null and when I console.log(data) array of images are showing on console please help…..
import { results } from "../../product"
export default function FetchProduct(products) {
const productsDetailArray = () => {
const temp = []
for (let i = 0; i < products.length; i++) {
const productId = products[i].productId
console.log(products[i])
const data = results.filter((item) => item.id === productId)
console.log(data.images)
temp.push({
count: products[i].count,
product: { ...data, images: [...data.images] },
})
}
return temp
}
return productsDetailArray()
}