'Push an array to an array of the same type in Vue3 typescript

I have an array of Obj1. In a project vue 3+ts , after clicking the button "load more", i call via axios the backend service and retrive an array of the same type. I want to append this rows to the previous array, but it is not working :

this.Array1.push(response.data)

If i add 1 item at the time, the Array1 gets updated:

this.Array1.push(response.data[0])

What am i missing?



Solution 1:[1]

You're pushing different values. response.data.results is an array, while response.data is a json data with an array.

So, you might want to just do:

this.Array1 = response.data.results

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jefferson Andrade