You forgot another important use-case that is the 'return use case'.
You can use return to execute code that will be executed every time the component is about to destroyed.
This is most useful if you have created an event listener in useEffect and want it to be destroyed before the component is rerendered or else multiple event listeners might be created.
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 forgot another important use-case that is the 'return use case'.
You can use return to execute code that will be executed every time the component is about to destroyed.
This is most useful if you have created an event listener in useEffect and want it to be destroyed before the component is rerendered or else multiple event listeners might be created.