watch — explicit dependencies, access to old value. watchEffect — auto-tracked.
1import { ref, watch, watchEffect } from "vue"23const count = ref(0)4const name = ref("John")56// watch - explicit7watch(count, (newVal, oldVal) => {8 console.log(`Count: ${oldVal} -> ${newVal}`)9})1011// watchEffect - auto-tracked12watchEffect(() => {13 console.log(`Count: ${count.value}, Name: ${name.value}`)14})
Key differences: