mkosm
02/17/2022, 11:36 AMrender
a class component without RBuilder
? This is what I'm trying to migrate:
fun main() {
render(document.getElementById("root")) {
child(App::class) {}
}
}
Sean Proctor
02/17/2022, 12:32 PMApp
to a functional component.
val App = FC<Props> {
// Body from old render method here
}
fun main() {
render(App.create(), document.getElementById("root"))
}
mkosm
02/17/2022, 12:41 PMmkosm
02/17/2022, 1:02 PMApp
class implement ComponentClass<Props>
):
val container = document.getElementById("root") ?: error("Couldn't find root container!")
render(createElement(App(), jso { }, null), container)
but I get this exception:
Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object.
mkosm
02/17/2022, 1:03 PMturansky
02/17/2022, 1:16 PMfun main() {
render(
App::class.react.create(),
document.getElementById("root"),
)
}
mkosm
02/17/2022, 1:29 PM