Kevin Luo
11/16/2021, 9:00 PMreact-dom
library. I can't set the ref
attribute for my react components, since it no longer allows passing lambdas to attrs.ref
.
var myRef : Element? = null
styledDiv {
attrs.ref {
myRef = it as? Element
}
}
So the above code no longer works. Is there a workaround for this?turansky
11/16/2021, 9:40 PMvar myRef : Element? = null
styledDiv {
attrs.ref = RefCallback<Element> {
myRef = it
}
}
Via useRefState
val (element, elementRef) = useRefState()
styledDiv {
attrs.ref = elementRef
}
Kevin Luo
11/17/2021, 1:50 AM