cfnz
07/29/2021, 10:17 PMturansky
07/29/2021, 11:07 PMFor example, is this to make things more “React like”?Compose-like (JSX-like?)
turansky
07/29/2021, 11:10 PMI could not find an issue discussing it or anything describing the why.Main problems described here Return type removed as cleanup result Cleanup in progress 🙂
turansky
07/29/2021, 11:10 PMcfnz
07/29/2021, 11:25 PMcfnz
07/29/2021, 11:33 PMcfnz
07/29/2021, 11:59 PMBecause this can be quite cumbersome to write, you can define anextension function to make the call site a bit cleaner, allowing you to writeRBuilder
instead:welcome("Kotlin")
fun RBuilder.welcome(name: String) = child(welcome) {
attrs.name = name
}
It seems that all these RBuilder extension functions may need to be tweaked, which might mean that most peoples components may have to be tweaked... though I guess now child returns Unit, so as long as the code calling it does not assume a ReactElement is returned, it might still be OK.
Lots (well, some of the stuff I have looked at :-)) of my client code however assumes a ReactElement is returned.turansky
07/30/2021, 12:05 AMchild
- redundant in your caseturansky
07/30/2021, 12:07 AMfun RBuilder.welcome(name: String) {
welcome {
attrs.name = name
}
}
Future:
fun RBuilder.welcome(name: String) {
welcome {
// no attrs
this.name = name
}
}