What is the equivalent in Kotlin JS to JavaScript ...
# javascript
a
What is the equivalent in Kotlin JS to JavaScript ... As in example here:
Copy code
<Button
          {...triggerProps}
          isSelected={isOpen}
          onClick={() => setIsOpen(!isOpen)}
          iconBefore={<MediaServicesAddCommentIcon label="Add" />}
        />
How can I achieve this "injection" of triggerProps into my component in KotlinJS?
t
Copy code
Object.keys(tritggerProps).forEach { key ->
    // add attributes 
}
a
Thank you, but how to "add attributes" ?
Have managed it
Copy code
Object.keys(triggerProps).forEach { key ->
    val descriptor = Object.getOwnPropertyDescriptor<RProps>(triggerProps, key)
    Object.defineProperty(attrs, key, descriptor)
}
t
Copy code
attrs.asDynamic()[key] = tritggerProps.asDynamic()[key]
@Alexander Weickmann works on
dynamic
?
a
@turansky what do you mean exactly? Both the triggerProps and the attrs are of type RProps. The code that I posted above works without dynamic ...