0👍
✅
try using push as a function, and passing the new object to push as a parameter:
const addItemCart = ref([])
const addToCart = (event) => {
let itemId = event.target.id
let itemName = event.target.name
let category = event.target.getAttribute("data-category")
addItemCart.value.push({ id: itemId, name: itemName, category: category })
//here we push the new item as an object into `addItemCart.value`
}
Source:stackexchange.com