📌 참고 📌
https://www.youtube.com/watch?v=QxQvKM6hzDk&list=PLuHgQVnccGMCRv6f8H9K5Xwsdyg4sFSdi&index=39
어떤 작업을 수행할 때 사용자에게 한번 더 되묻는 용도
사용자가 확인을 누르면 true
을 반환하며 작업을 수행한다.
if(window.confirm('really?')){ // 사용자에게 되묻기
alert('delete complete');
}
splice(삭제할 대상, 범위)
원본이 변경 되므로 Array.from()
으로 원본을 복제 후
삭제 작업을 수행하는 것을 권장
// 삭제할 대상(id) 을 찾는 반복문
for(let i = 0; i < this.state.contents.length; i++){
if(_contents[i].id === this.state.selectedId){
_contents.splice(i, 1);
}
}