$ grep -rl "#setInterval" posts/
1 posts tagged with setInterval.
setInterval 콜백 안에서 state를 업데이트하면 값이 한 번만 바뀌고 더 이상 변하지 않는다. 콜백이 처음 렌더링 시점의 state를 클로저로 붙잡고 있기 때문이다. 함수형 업데이트나 useRef로 해결할 수 있다.