Does anyone know how to use inline styles with kot...
# javascript
b
Does anyone know how to use inline styles with kotlin-html? (Currently, I am trying to move a
<div>
across the screen using
top
and
left
css properties on mousedown. Using kotlin-react and styled components takes around 1000 times longer (most of the time from recalculating styles) than a pure JS solution that simply changes the inline
<div>
style.)
r
try this:
Copy code
div {
	attrs["style"] = js { top = "10px" }
}
b
Sweet, that seems to work nicely. Thanks for the help. (BTW, is there any documentation for more nuanced things like this?)
r
I don't think so. A few months ago it took me two hours of trials and errors to find this solution 😉
b
Oh, too bad. Many thanks again for those thankless hours spent tinkering.