Inflearn Community Q&A
useEffect 질문있습니다.
Written on
·
225
0
useEffect(() => { // componentDidMount, componentDidUpdate = 합쳐놓았다고 생각
console.log('랜덤')
interval.current = setInterval(changeHand, 100)
return () => { // componentWillUnmount
console.log('랜덤종료')
clearInterval(interval.current)
}
}, [imgCoord]) // componentDidUpdate
componentwillMount가 헷갈리는게
componentDidMount, componentDidUpdate 이후에 바로 실행이 되는건가요~?
아니면 componentDidUpdate가 되면서 기존 컴포넌트가 리렌더링 될 때 일어나나요? 궁금합니다.
react
Answer 2
1
0
yahoo23447340
Questioner
useEffect에서 componentwillUnMount인데 오타가 났네요... useEffect의 작업이 끝난후 바로 return이 실행되나요?




