javascript - Why does react need the key attribute to identify elements, but vue does not?
三叔
三叔 2017-06-26 10:55:21
0
3
750

Why does react need the key attribute to identify elements, but vue does not? Which method does vue use to identify elements?

  • Duke
  • Villanova
  • Connecticut
  • Duke
  • Villanova
三叔
三叔

reply all (3)
阿神

Who said vue has no key.

Whether it is vue or react, the key plays the same role. React does not need it, it just reports a warning.

    大家讲道理

    Vue also needs it, the official website reads: In order to give Vue a hint so that it can track the identity of each node and thus reuse and reorder existing elements, you need to provide a unique key attribute for each item. The ideal key value is that each item has a unique id. Link the key in vue

      洪涛

      Each corresponding unique key, so that react can know which key data you are operating on later, and you can update only this one

        Latest Downloads
        More>
        Web Effects
        Website Source Code
        Website Materials
        Front End Template
        About us Disclaimer Sitemap
        php.cn:Public welfare online PHP training,Help PHP learners grow quickly!