defineProps khai báo props mà component nhận, defineEmits khai báo events mà component emit:
javascript
// TypeScript style (recommended)
const props = defineProps<{
title: string
count?: number
}>()
const emit = defineEmits<{
(e: 'update', value: number): void
(e: 'close'): void
}>()
// Dùng
emit('update', 42)Pitfall: defineProps không thể destructure trực tiếp mà giữ reactivity trong Vue 3.4 trở về trước — dùng toRefs(props).
Từ Vue 3.5+: destructure props với const { title } = defineProps() giữ reactivity.