listen to props deep change in vue js 2

To listen to deep changes in props in Vue.js 2, you can use a watcher. A watcher is a Vue.js feature that allows you to react to changes in a property or computed property.

Here are the steps to listen to deep changes in props using a watcher:

  1. In your component, define the props you want to watch. You can do this by adding a props option to your component definition and specifying the names of the props you want to watch. For example:
props: ['myProp'],
  1. Add a watch option to your component definition. This option should be an object with the names of the props you want to watch as keys, and the corresponding watcher functions as values. For example:
watch: {
  myProp: function(newVal, oldVal) {
    // Do something when the prop changes
  }
},
  1. Inside the watcher function, you can access the new value of the prop as newVal and the old value as oldVal. You can then perform any necessary actions based on these values.

That's it! With these steps, you can listen to deep changes in props in Vue.js 2 using a watcher.