Rafał Kuźmiński
01/20/2023, 4:30 PMexternal interface ExampleProps : Props {
var optionalProp: String?
var mandatoryProp: String
}
val Example = FC<ExampleProps> { props ->
}
Decorator:
fun ChildrenBuilder.ExampleDecorator(mandatory: String, prop: ChildrenBuilder.(props: ExampleProps) -> Unit) {
Example {
prop(this)
mandatoryProp = mandatory
}
}
and usage:
val usage = FC<Props> {
Example {
// Here this is ChildrenBuilder & ExampleProps & Props
}
ExampleDecorator("abc") {
// Here it is ExampleProps and this is ChildrenBuilder
}
}
As you can see, in ExampleDecorator ExampleProps is not in "this" but in "it". How can I change this to create same receiver type as React?turansky
01/20/2023, 5:32 PMChildrenBuilder
- don’t use ChildrenBuilder
directly 🙂Rafał Kuźmiński
01/20/2023, 5:56 PMturansky
01/20/2023, 10:43 PMRafał Kuźmiński
01/23/2023, 9:03 AM