Fix React "unique key prop" warning

This commit is contained in:
Deluan
2021-02-02 18:00:06 -05:00
parent a3eb14d7f4
commit e79922def1
+4 -4
View File
@@ -81,13 +81,13 @@ const AlbumComment = ({ record }) => {
const [expanded, setExpanded] = React.useState(false) const [expanded, setExpanded] = React.useState(false)
const formatted = useMemo(() => { const formatted = useMemo(() => {
return record.comment.split('\n').map((line) => ( return record.comment.split('\n').map((line, idx) => (
<> <span key={record.id + '-comment-' + idx}>
{line} {line}
<br /> <br />
</> </span>
)) ))
}, [record.comment]) }, [record.comment, record.id])
const handleExpandClick = useCallback(() => { const handleExpandClick = useCallback(() => {
setExpanded(!expanded) setExpanded(!expanded)