Hi. I have created a button component in React wit...
# javascript
s
Hi. I have created a button component in React with Kotlin/JS. I let its properties implement the ButtonHTMLAttributes interface. I was wondering, is there a way to could I pass all properties belonging to the ButtonHTMLAttributes interface to an internal button HTML element? Below is the component I created, and currently I manually set some properties.
Copy code
external interface ButtonProps : ButtonHTMLAttributes<HTMLButtonElement>

val Button = FC<ButtonProps> { props ->
    button {
        type = props.type
        disabled = props.disabled
        +props.children
    }
}
Essentially, I am wondering what the Kotlin approach would be (if it exists) to achieve what is done in this SO answer in JS: https://stackoverflow.com/a/62568833
t
Unsafe mode looks like this:
Copy code
button {
    +props
}
s
That helps, thanks!