How does Vue’s reactivity differ when using ref vs. reactive, and when would you choose one over the other?

ref is a reactive primitive wrapper, useful for single values, while reactive deeply tracks objects. ref is preferred for simple state, and reactive for nested data structures where granular reactivity is beneficial.