classtranscribe / FrontEnd

The React + Redux Frontend for ClassTranscribe
https://classtranscribe.illinois.edu
Other
25 stars 27 forks source link

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

Closed angrave closed 3 weeks ago

angrave commented 7 months ago

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