I want to watch props passed to a composition function from setup:
async setup(props) {
const { data } = await useOperation(query, props.isEdit);
}
and each time the value of isEdit changes, I want to do something in the watch:
export const useOperation = async (query, isEdit) => {
const reload = ref(isEdit)
watch(
() => reload.value,
(result) => {
console.log(result)
}
)
const { data } = await fetch(query)
return {
data
}
}
When props.isEdit changes, the watch is not triggered. How do I make this work?