converter componentwillunmount em useeffect

useEffect(() => {
  return () => {
    // code to run when the component is unmounted
  }
})
Vast Vulture