Using lifecycle functions in abstract function?
Just wondering if there are any consideration to be taken into account when calling lifecycle functions like
onMount
or onCleanup
inside some abstracted function made to reuse code, like a hook in react.
Would it work fine so long as the function gets called in a component, or anything else to keep in mind?
And is this something inline with what custom directives like use
are designed for, or its unrelated?
For context in my specific situation would like to register global event listeners for mouseup
and remove them once the component is gone.
Thank you for any input!2 Replies