andylamax
12/01/2020, 9:50 AMprivate class Counter(props: Counter.Props) : RComponent<Counter.Props,Counter.State>(props) {
class Props(val initialValue: Int):RProps
class State(val value: Int) : RState
// . . .
}
fun RBuilder.Counter(initialValue: Int = 0) = child(Counter::class.js,Counter.Props(initialValue)){}
This made only RBuiler.Counter()
available to consumers. However, with IR backend we need to mark our components with @JsExport
. Sadly, IR backend won't export a private class/function it results in error upon minification similar to when you don't mark the component with @JsExport
Currently, I have resorted to leaving them public. This works but again it exposes code that wasn't meant to be public. Also pollutes the namespace as every tiny component is available on the entire project. Which is really huge.
Is there a workaround I can use, so that I may use the IR
backend, export my components but still make them private/internal
?ankushg
12/01/2020, 3:00 PMandylamax
12/01/2020, 3:53 PMandylamax
12/02/2020, 2:53 AMComponents
ankushg
12/02/2020, 3:09 AMComponent
instead of the Counter
subclass? that might let you make the entire Counter
class private