Why reactive() Can Quietly Slow You Down
In Vue 3, reactive() and ref() (for objects/arrays) wrap your data in a deep Proxy. Every nested property is intercepted so the view can update. That is perfect for small state — but for a 10,000-item array fetched from an API, Vue recursively proxies each element on access. The cost shows up as jank when you map, filter, or render large lists.
The fix is shallowRef: it tracks the .value reference itself, not what is nested inside it. No deep proxy, no per-item overhead.

The Basic Pattern
import { shallowRef, triggerRef } from 'vue'
// Holds a large array WITHOUT deep-proxying every item
const rows = shallowRef([])
async function load() {
const res = await fetch('/api/big-table')
const data = await res.json()
// Reassigning .value DOES trigger an update
rows.value = data
}
Reassigning .value works because shallowRef watches the reference, not the contents.
The Gotcha: Mutating In Place Won’t Re-render
This is the trap that bites everyone at least once:
// ❌ No re-render — Vue never sees the change
rows.value.push(newItem)
// ✅ Reassign so the reference changes
rows.value = [...rows.value, newItem]
// ✅ Or keep the mutation AND force the update
rows.value.push(newItem)
triggerRef(rows.value) // tell Vue "I changed it"
Use triggerRef when you must mutate in place (e.g. sorting a big array you do not want to clone) and still want the view to update.
When to Reach for It
- Large lists / tables rendered with
v-for - Third-party data structures (Maps, class instances) you do not want proxied
- Canvas / WebGL state, chart libraries, immutable libraries
- Hot paths where you have measured deep-proxy overhead
Pair shallowRef with shallowReactive for object-shaped state. If you need fine-grained reactivity inside a slice, switch back to ref/reactive for just that part.
A Complete Example
<script setup>
import { shallowRef, triggerRef } from 'vue'
const points = shallowRef([])
function addPoint(x, y) {
points.value.push({ x, y })
triggerRef(points) // mutate + notify
}
function reset() {
points.value = [] // reassign also notifies
}
</script>
<template>
<button @click="addPoint(Math.random(), Math.random())">Add</button>
<button @click="reset">Reset</button>
<p>{{ points.value.length }} points</p>
</template>
Reassign for free updates, mutate + triggerRef when cloning is too expensive — that is the whole mental model.