Watch Anything in Your Component

It took me a very long time to realize this, but anything in your component that is reactive can be watched:

export default {
computed: {
someComputedProperty() {
// Update the computed prop
},
},
watch: {
someComputedProperty() {
// Do something when the computed prop is updated
}
}
};

You can watch:

If you're using the composition API, any value can be watched, as long as it's a ref or reactive object.

Want to level up your Vue skills?

With over two million reads and 11,067 subscribers, you've come to the right place.

Subscribe now to get exclusive insights and tips every week.