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
refs are not reset back to undefined unfortunately
So no way to gain that knowledge with refs alone
You can call onCleanup inside the ref callback though
@thetarnav not sure i understand completely, what is the ref callback here? 😅
ah i think i get it.
Like this i suppose
thanks