How do you give focus to a div in kotlin react

Having problems giving focus in a kotlin react project, has anyone done this?

Hi,

Two ways, easy html5 way and longer way… (assuming input as focus control)

Easy way:

    div {
        input(InputType.text) {
            attrs["autofocus"] = "autofocus"
        }
    }

Harder way with a ref:

// State var
private var testRef: Element? = null
...
override fun componentDidMount() {
    testRef.asDynamic().focus() // should check for null...
}
... in render function...
    div {
        input(InputType.text) {
            ref {
                testRef = findDOMNode(it)
            }
        }
    }

Hope it helps.
Colin