Looking for a method to create a ref that can hold an array in my Vue 3 app built using composition API and typescript.
The array will be utilized in a computed property where objects will be pushed. However, I encountered an issue when trying to push objects into the array within the computed property:
Error: Property 'push' does not exist on type 'Ref<[]>'
This is the current code snippet I am working with:
const myArray = ref<[]>([]);
const myComputed = computed(() => {
if (propertyOne) {
myArray.push({ id: 'autoId0', path: 'myPath' })
}
return myArray
})
I have also attempted using let myArray = []
inside the computed property but the array remains empty. Any advice or suggestions would be highly appreciated!