Hello I have mapped array like this and I need to move objects based on ean which user input to another array
const transformedData = data.order_items.map((invoiceData) => {
return {
ean: invoiceData.ean,
name: invoiceData.name,
count: invoiceData.count,
};
});
I have tried something like this, but every time I try to add another object it always overwrite the existing one. And I am also not able to remove it from transformedData array
const filteredExpeditionProducts = expeditionProducts.filter(
(order_item) => order_item.ean.toString() === enteredEan
);
filteredExpeditionProducts.map((invoiceData) => {
return {
ean: invoiceData.ean,
name: invoiceData.name,
count: invoiceData.count,
};
});
I would appreciate any help
Aucun commentaire:
Enregistrer un commentaire