Delete기능 구현하기

contextControl = <>
<li> <a href={"/update"+id} onClick={event=>{
event.preventDefault();
setMode('UPDATE');
}}>Update</a> </li>
<li><input type="button" value="Delete" onClick={()=>{
const newTopics = []
for(let i=0; i<topics.length; i++){
if(topics[i].id !== id){
newTopics.push(topics[i]);
}
}
setTopics(newTopics);
setMode('WELCOME');
}}/></li>
</>
삭제해야 할 대상은 topics의 데이터
const newTopics=[]의 빈 배열을 생성한다.newTopics.push(topics[i]);)setTopics(newTopics)