How to listen for props changes in Vue
Listening props changes in Vue 3
This is written using Vue 's Composition API .
<script setup lang="ts">
import { computed } from 'vue';
const props = defineProps<{
data: Object
}>();
// if not using Typescript
// const props = defineProps(['data'])
const listenDataChange = computed(() => props.data);
</script>
In template tag.
<template>
<p>{{ listenDataChange }}</p>
</template>