Vue dùng :key để identify mỗi vnode khi diff — giúp tái sử dụng và reorder DOM nodes đúng cách thay vì re-render toàn bộ.
- Thiếu key: Vue dùng "in-place patch" — có thể gây lỗi với stateful components hoặc animation
- Dùng index làm key: không nên khi list có thể bị sort/filter — index thay đổi gây re-render sai
- Dùng unique stable ID (e.g.,
item.id) là best practice