loading...

re: Difficulties Encountered with React Hooks VIEW POST

FULL DISCUSSION
 

How can I replicate the behavior of componentWillUnmount? It's important when the component subscribes to events when mounted.

 

Does returning a callback function for cleanup not work in your case?

useEffect(() => {
  // do something
  return () => yourCleanupHere()
})
 

Missed that feature, thanks for letting me know.

code of conduct - report abuse