Refs cleanup when element unmounts

I would have thought the ref update back to "undefined" oncethe element unmounts the same way it updates when the element is created anew. Like is there a way that I can know based on the ref signal, that the element no longer actually exists? Playground: https://playground.solidjs.com/anonymous/138ba522-afa4-4563-b896-0bd2d329f293
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
5 Replies
fabiospampinato
refs are not reset back to undefined unfortunately So no way to gain that knowledge with refs alone
thetarnav
thetarnav2y ago
You can call onCleanup inside the ref callback though
KamehamehaNudel
@thetarnav not sure i understand completely, what is the ref callback here? 😅
KamehamehaNudel
ah i think i get it. Like this i suppose
KamehamehaNudel
thanks
Want results from more Discord servers?
Add your server
More Posts