Franco
06/15/2021, 1:02 AMPrompt
component in React Router and we can't get it to work. This is the code we have:
@file:JsModule("react-router-dom")
@file:JsNonModule
package react.router.dom
import react.Component
import react.RProps
import react.RState
import react.ReactElement
@JsName("Prompt")
internal external class Prompt : Component<PromptProps, RState> {
override fun render(): ReactElement?
}
internal external interface PromptProps : RProps {
var `when`: Boolean
var message: String
}
This is the wrapper function we created:
public fun RBuilder.prompt(show: Boolean, message: String): ReactElement {
return child(Prompt::class) {
attrs.`when` = show
attrs.message = message
}
}
And this is how we are calling it inside the render()
of another component:
prompt(show = true, message = "ERROR")
Anyone knows what we are doing wrong?turansky
06/15/2021, 12:54 PMval internal external Prompt: RClass<PromptProps>
?Franco
06/16/2021, 2:53 AMturansky
06/16/2021, 12:25 PMcommonjs
module type?turansky
06/16/2021, 12:26 PMturansky
06/16/2021, 5:08 PMFranco
06/29/2021, 3:59 AMkotlin-wrappers
as you suggestedFranco
06/29/2021, 3:59 AMturansky
06/29/2021, 9:11 AM