Hi everybody. I am in the process of migrating my ...
# react
d
Hi everybody. I am in the process of migrating my application. For the own functional components this is (so far ;)) no problem. However, I also use external components where I currently don't know how to migrate them easily. Does anyone have an example or a tip for this?
Copy code
@JsName("default")
external object ButtonComponent : Component<ButtonProps, ButtonState> {
    val Group: ButtonGroupComponent

    override fun render(): ReactElement? // Has to be ReactNode
}

fun RBuilder.aButton(handler: RHandler<ButtonProps>) = child(ButtonComponent::class, handler)
1
b
For external class-components one should use RClass instead (at least that's how it was a year ago). i.e.
Copy code
external val ButtonComponent: RClass<ButtonProps, ButtonState>

//OR

external class ButtonComponent: RClass<ButtonProps, ButtonState>
d
I believe RClass no longer exists in the "new" React wrapper? At least IntelliJ does not find this class.
t
Copy code
external val Button: ComponentClass<ButtonProps>
Type names were synchronized with TS definitions
d
Thank you very much! I couldn't test it in the big project because of the size, but it worked in a new test project.