This product is not supported for your selected Datadog site. ().
이 페이지는 아직 영어로 제공되지 않습니다. 번역 작업 중입니다. 현재 번역 프로젝트에 대한 질문이나 피드백이 있으신 경우 언제든지 연락주시기 바랍니다.
Metadata
ID:tsx-react/list-component-needs-key
Language: TypeScript
Severity: Warning
Category: Code Style
Description
In TypeScript, particularly when dealing with React, it’s important to provide a unique key prop for each child in a list. This rule ensures that each item in a list has a unique key. Keys help React identify which items have changed, are added, or are removed, and help in efficient re-rendering of the component.
Not having a unique key can lead to issues with the component’s state and inefficient re-rendering. Without keys, React has to fall back to a slower, less efficient default diffing algorithm.
To avoid violating this rule, always provide a unique key when mapping over an array to create a list of React elements.