You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the feature you'd love to see
Similar to the new React 19 feature, it would be great to be able to use cleanup functions with callback refs.
<inputref={(ref)=>{// ref created// REQUESTED: return a cleanup function to reset// the ref when element is removed from DOM.return()=>{// ref cleanup};}}/>
This would make it easier to connect Preact components to DOM APIs like MutationObserver, which currently need some hooks/effects. Using object refs and effects is more error-prone as it requires syncing up whatever conditional rendering logic you have between your returned elements and effects.
Describe the feature you'd love to see
Similar to the new React 19 feature, it would be great to be able to use cleanup functions with callback refs.
This would make it easier to connect Preact components to DOM APIs like MutationObserver, which currently need some hooks/effects. Using object refs and effects is more error-prone as it requires syncing up whatever conditional rendering logic you have between your returned elements and effects.
Additional context (optional)
https://react.dev/blog/2024/04/25/react-19#cleanup-functions-for-refs
The text was updated successfully, but these errors were encountered: