Fix React "unique key prop" warning
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user