Uniqueness of the REACT array key

Source: Internet
Author: User

1. Do not use the index index of the array as key

2, in the adjacent elements, it is necessary to ensure the uniqueness of key, if the same key appears, will throw a Warning, tell the adjacent components have a duplicate key value. And only the elements in the first duplicate key value will be rendered, because react will assume that subsequent ownership of the same key is the same component.

3, stability is important here, because if the key value has changed, react will trigger the UI re-rendering. This is a very useful feature

https://www.jianshu.com/p/c74624223986

Uniqueness of the REACT array key

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.