setTimeout(function() { }, [3000])
3000ms 후에 함수 실행
const offAlert=()=>{
let copy = [...cards]
setTimeout(function() {
for(let i=0; i<copy.length; i++) {
copy[i].alert.isClicked = false
}
setCards(copy)
},2000)
}
문제점
: 연속으로 클릭시 alert 창이 2000ms 보다 짧게 켜짐
해결법
: 뭘까?