Both run side effects in response to reactive changes, but they differ in how dependencies are specified and what info they give you. Use them for side effects (API calls, logging, manual DOM work) — not for deriving values (that's computed).
watch — explicit source, gives old + new values
<script setup>
import { ref, watch } from "vue";
const searchQuery = ref("");
watch(searchQuery, (newVal, oldVal) => {
// runs ONLY when searchQuery changes; you get both values
console.log(`changed from ${oldVal} to ${newVal}`);
fetchResults(newVal);
});
</script>
