You can also use useEffect as componentWillUnmount if you make it return a function! This function will be called when the component is about to unmount.
This would console log "mounted" when component did mount and console log "will unmount" when component was about to unmount.
This way we can mimic even better the class components' life cycle methods ;)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You can also use useEffect as componentWillUnmount if you make it return a function! This function will be called when the component is about to unmount.
This would console log "mounted" when component did mount and console log "will unmount" when component was about to unmount.
This way we can mimic even better the class components' life cycle methods ;)