When react implements the delete operation of the comment function, there is a problem with the element update.

use react to write comments (marked how long ago the comment was posted, updated every 5s), but when you delete the first record, the time of the comment is displayed as the time of the deleted record. Only after 5s can the time be displayed normally.

/ / components of comments
import React, {Component} from "react"
import propTypes from" prop-types"
export default class Comment extends Component {

static propTypes={
    comment:propTypes.object.isRequired,
    click:propTypes.func,
    index:propTypes.number
}
constructor(){
    super();
    this.state={
        timeString:"",
    }
    this.handleDeleteComments = this.handleDeleteComments.bind(this);
    //this.handleContent = this.handleContent.bind(this);
}
componentWillMount(){
    this.handleUpdate();
    //
    this._timer=setInterval(
        this.handleUpdate.bind(this),
    5000);
}
componentWillUnmount(){
    clearInterval(this._timer);
}
handleUpdate(){
    console.log(this.props.comment.createdTime);
    var time = (new Date().getTime()-new Date(this.props.comment.createdTime).getTime())/1000;  //
    console.log(time);
    if(time/60>=1){
        this.setState({
            timeString: `${Math.floor(time/60)}`
        })
    }else{
        this.setState({
            timeString: `${Math.floor(Math.max(time,1))}`
        })
    }
}
handleDeleteComments(){
    this.props.click(this.props.index);
}
handleContent(content){
    //xss``
    return content.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,""")
    .replace(/"/g,""").replace(/`([\S\s]+?)`/g,"$1")
}
render(){
    return(
        <li className="comment_user">
            <span>{this.props.comment.username}</span>
            <label dangerouslySetInnerHTML={{
                  __html: this.handleContent(this.props.comment.content)
            }} />
            <a className="delete" onClick={this.handleDeleteComments}></a>
            <span className="time">{this.state.timeString}</span>
        </li>
    )
}

}

/ / error screenshot

I guess it is because of component reuse, but the problem of setting different key values has not been solved. Which boss can take a look at it? thank you!

Mar.07,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35fe6-2bfd4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35fe6-2bfd4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?