Vue.js & Composition API (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)
Optimizing Performance with `shallowRef()` and `shallowReactive()`.
senior LevelFormsPerformanceSystem Design
In Simple Words:
Standard ref() and reactive() recursively convert all nested properties into Proxies.
If you fetch a massive array of 50,000 read-only table records from an API:
- Deep reactivity creates 500,000 Proxies, burning memory and freezing the browser.
shallowRef(massiveArray): Only tracks.valuereassignment. Nested object mutations are not tracked, saving 90% of memory overhead!