Replacing the array as you are doing on the first snippet should work fine.
You can try using $forceUpdate()
this.blogTitles = JSON.parse(response.data.r.article);
this.$forceUpdate();
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi all,
I haven't played with vue for a few months and just got stuck with its reactivity.
I have an AXIOS response which needs to replace fully the array data by the response array: this.blogTitles has initially an array loaded on DOM load. When I click a button, I need the response data to fully replace the old data.
this.blogTitles = JSON.parse(response.data.r.article); // AXIOS response with the array
The array data is being replaced ok, but my loop is not reloading the DOM data and stays there without any reactivity.
{{blogTitles }} //I can see the new data output here(but not below in the loop)
<div v-for="(item, index) in blogTitles" :key="item.id">
//No change in data happening
</div>
The problem is that based on the vue doc is says to use Vue.$set() but this needs 3 parameters. I only want to the replace the whole lot and not individual keys.
Any idea how to add reactivity in this case please?
Thanks
Replacing the array as you are doing on the first snippet should work fine.
You can try using $forceUpdate()
this.blogTitles = JSON.parse(response.data.r.article);
this.$forceUpdate();
Please or to participate in this conversation.