애플후레시 마지막 강의 숙제에서 idx를 매개변수로 받아서 각 리스트를 조작하려고 했습니다.
코드는 다음과 같습니다.
function plusCount(i) {
let copy = [...count[i]];
copy++;
setCount(copy);
}
function minusCount(i) {
let copy = [...count[i]];
copy--;
setCount(copy);
}
복사를 하여 조작했음에도
TypeError: count[i] is not iterable 와 같이
iterable 에러가 발생합니다.
복사를 할 때 index값을 사용할 수는 없는건가요?