Skip to content

INote editor don't use index position for keys for items in a react list #733

@angrave

Description

@angrave

Dont use index for the key for an item in a list. Unexpected updates can happen - especially when the list length changes or things are re-ordered (e.g. splitting).
Better: Create a unique id (e.g. uuid) for each listitem (e.g. chapter) and use that for the key.

/Users/angrave/2023/classtranscribe-fall2023/FrontEnd/src/screens/EPub/views/EditEPubChapter/ChapterEditor/ChapterContent.js
  106:64  warning  Do not use Array index in keys  react/no-array-index-key
/Users/angrave/2023/classtranscribe-fall2023/FrontEnd/src/screens/EPub/views/EditEPubChapter/ChapterEditor/ChapterInfo.js
  65:16  warning  Do not use Array index in keys  react/no-array-index-key
/Users/angrave/2023/classtranscribe-fall2023/FrontEnd/src/screens/EPub/views/EditEPubChapter/ChapterEditor/SubChapterItem.js
  71:16  warning  Do not use Array index in keys  react/no-array-index-key
/Users/angrave/2023/classtranscribe-fall2023/FrontEnd/src/screens/EPub/views/EditEPubStructure/ChapterList/EPubListItem.js
/Users/angrave/2023/classtranscribe-fall2023/FrontEnd/src/screens/EPub/views/EditINote/INoteEditor/INoteChapter.js
  249:30  warning  Do not use Array index in keys  react/no-array-index-key

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions