Home / Companies / Netlify / Blog / Post Details
Content Deep Dive

Choosing Between Ref and Reactive with Vue 3's Composition API

Blog post from Netlify

Post Details
Company
Date Published
Author
Ben Hong
Word Count
910
Language
English
Hacker News Points
-
Summary

When working with Vue 3's Composition API, a common question is whether to use `ref` or `reactive`. While `ref` is the fundamental building block for reactive data in Vue, it has some downsides, including requiring an understanding of JavaScript proxies and adding bulk to the code. On the other hand, `reactive` is much closer to what developers are already familiar with, being similar to the data option in the Options API. However, using `reactive` requires no unpacking values like `ref`, making it more intuitive and easier to use. Ultimately, `reactive` is recommended as the primary way to manage reactive data in Vue 3's Composition API, but there are still use cases for using `ref`.