Why can I return a function from onMount?
Quick question:
I'm allowed to (as in "TypeScript allows me to") return a function from the function I declare inside onMount.
The docs does not comment on this (https://docs.solidjs.com/reference/lifecycle/on-mount), so what does it do? When is the returned function run?
Example:
10 Replies
Nothing
Welp. It could be? https://github.com/solidjs/solid/pull/2323
You could add the
onCleanup
to your onMount
?
I'm not sure if this will be added tbhIs that a thing? I.e.:
It feels wrong for some reason
You can put
onCleanup
generally whereverMan. I thought I had an incling of how those tracking scopes where implemented. But not anymore. That's for sure
fun fact, you can also do effects within effects
Now, that's illegal
Or. At least should be. Sounds ripe for OOM and other crashes
Yeah probably, I haven't found a usecase for them but I'm pretty sure it's used in the wild by someone
might even be used in
solid-primitives
somewherePeople are so concerned with whether they could - they didn't stop to think on whether they should
- Some guy. Probably from Jurassic Park