disposableRef
fun <TElement : Element> disposableRef(vararg keys: Any?, effect: DisposableEffectScope.(TElement) -> DisposableEffectResult): ElementRefScope<TElement>(source)
Create a ref listener which informs you both when a raw element is added to the DOM tree and when it is removed.
The last call in the block must be to onDispose
.
For example:
disposableRef { element ->
println("${element.localName} was added to the dom.")
onDispose { println("${element.localName} was removed from the dom.") }
}
Content copied to clipboard
Parameters
keys
Any number of keys which, if any change, will cause the effect to be disposed and restarted.