How to Watch Props Change with Vue Composition API / Vue 3?

This guide shows how to monitor and respond to prop changes in Vue 3 using watch() with toRef() or toRefs() effectively.

In Vue 3's Composition API, watching for prop changes is essential when you need to respond to updated values passed from a parent component. Unlike Vue 2, you no longer use watch: {} in the options API but instead use the watch() function with toRefs() or toRef().

How to Watch Props in Vue 3 Composition API

To reactively watch a prop, use the watch() function inside the setup() method. Vue requires props to be wrapped with toRef() or toRefs() to retain reactivity.

Using toRef()

<script setup>import { watch, toRef } from 'vue' defineProps(['someProp'])   const props = defineProps() const someProp = toRef(props, 'someProp')   watch(someProp, (newVal, oldVal) => {   console.log('Prop changed:', oldVal, '→', newVal) }) </script>

Using toRefs()

<script setup>import { watch, toRefs } from 'vue'   const props = defineProps() const { someProp } = toRefs(props)   watch(someProp, (newVal, oldVal) => {   console.log('Updated:', newVal) }) </script>
Also Read: The Top Websites Built with Vue JS

Common Gotchas

Destructuring props without toRefs() or toRef() breaks Vue’s reactivity system. Use toRefs(props) for multiple props or toRef(props, 'key') for a single prop to keep reactivity intact.

Key Takeaway

In Vue 3 Composition API, use watch() with toRef() or toRefs() to track prop changes reactively. This helps you respond to parent-driven updates within components.

Related Resources

Related
Vue

Why You See "Vue is Not a Constructor" This error usually occurs when you're trying to use new Vue() to create an instance, but: Vue…

15 Oct, 2025
Vue

Vue encourages reactive and declarative programming for maintainability. But sometimes direct DOM access is required. In those cases, the $el property gives you access to…

10 Oct, 2025
Vue

When building complex UIs with drag-and-drop functionality and nesting draggable components, this is a common use case. This guide will show you how to use…

07 Oct, 2025
Request a Quote Schedule a Meeting