Pass prop name in watch callback
What problem does this feature solve?
This helps in adding dynamic watchers for dynamic component data
What does the proposed API look like?
watch (
()=> dataObject['propA'],
(prop, newValur, oldValue) =>{},
options
)
There isn't always a name property to be passed but you can do that by using an array:
const name = ref('dynamic name')
const object = reactive({})
watch(() => [name.value, object[name.value]], ([newName, newValue]) => {})