Hello, I like very much the late refactor of `kotl...
# react
a
Hello, I like very much the late refactor of
kotlin-react.
A lot of things are now very consistent. Follow question though. I see that we have
Copy code
interface RBuilder {
    // . . . 
    fun <P : Props> child(
        klazz: KClass<out Component<P, *>>,
        handler: RHandler<P>,
    )
    // . . .
}
Question is, why don't we have
Copy code
interface RBuilder {
    // . . . 
    fun <P : Props> child(
        klazz: KClass<out Component<P, *>>,
        props: P,
        handler: RHandler<P>,
    )
    // . . .
}
So that I may
Copy code
child(Hellow::class,jsObject{
  param1 = 1
  param2 = 2
  param3 = "three"
  // . . . 
})
instead of
Copy code
child(Hellow::class) {
 attrs {
  param1 = 1
  param2 = 2
  param3 = "three"    
 }
}
t
Common goals: • Hide
child
methods,
invoke
preferred • Remove class component specific methods (as non-flexible) cc @Sergei Grishchenko
Do you have custom class components?
a
1. rereeding my misleading post again. There is a big error. I meant to say, a lot of things are consistent now. 2. Yes, I do have custom class components
t
Main accent - function components Wanted main signature:
Copy code
Hellow {
  param1 = 1
  param2 = 2
  param3 = "three" 
}
without
attrs
block, without
RBuilder
🙂 Already works in draft
👍 1
KClass
- blocker for effective/minimalistic API
a
Thank you so much for your hard work. This low key tells me that, we should switch from classes to functional components, and i think its about time
When can I test that draft for functional components? or is it already publishable?
t
Function components are more usefull right now: • OOB DSL • Multiple contexts • Hooks • Ready (not draft) Example
a
thank you so much for this sample victor
t
I also use delegates for automatic name
a
as in
Copy code
val Profile by fc<Props> { . . . }
like that?
t
Yes
a
Hi victor, I am failing to use delegates for automatic naming of functional components, what imports do I have to use? sample?
t
I use custom delegates for different cases Right now common effective realizations locked by this issue
With
attrs
And without
attrs
👍 1
With last delegate you can write:
Copy code
ActionButton {
    label = "OK"
    onClick = props.onNext
}
Future main syntax 🙂
a
That looks smooooth
especially the last one
When is this coming in kotlin-react?
t
No strict deadlines
a
haha, I see what you did there . . . 😄