MemotivauseEffect and Side Effects

How do functional components replicate componentWillUnmount?

useEffect and Side Effects

Audio flashcard · 0:08

Nortren·

How do functional components replicate componentWillUnmount?

0:08

You return a cleanup function from useEffect. React calls that function when the component unmounts, which replaces componentWillUnmount from class components.