function DetailPage(props) {
let [animation, setAnimation] = useState('');
useEffect(()=> {
let timer2 = setTimeout(()=> {
setAnimation('end');
}, 100);
return ( ) => {
setAnimation('');
clearTimeout(timer2);
}
}, [])
return(
<div className={'container start ' + animation}>
... (이하 생략)
코드는 위와 같습니다.
useEffect 사용할 때, dependency에 [animation] 을 추가하니까 컴포넌트가 아에 안보이는데, 개발자도구 열어보니까 뭔가 무한로딩에 빠진 것 같아요.

처음 로드될때(마운트될 때)만 실행되면 되니까, dependency값이 필요없는건 알지만 animationState를 변경하는 곳이 없는데도 문제가 되는 이유를 알 수 있을까요...?