Hook을 사용한 ComponentWillUnmount

Hyor·2022년 12월 27일
0

useEffect는 componentDidMount, ComponentDidUpdate, ComponentWillUnmont에서 작동할 수 있기에 return값에 컴포넌트가 unmount되기 전에 실행할 함수를 사용하면됩니다.

useEffect(()=>{ 
    return(() => /** 실행할 함수 **/);
})
profile
개발 노트

0개의 댓글