انتقل إلى المحتوى الرئيسي

📄 Best Practices

1. Why you shouldn't use index as a key in lists and iterators?

為什麼不應該使用 index 作為 key 值?

Vue, React 等框架的面試題目中都會有類似的題目:

  • What happens if there is no key in v-for?
  • Why you shouldn't use index as a key in React lists and iterators?