Marc Knaup
11/29/2020, 6:22 PMkotlin-react
and kotlinx-html
, so I’ve started my own React wrapper.
• Similar to kotlin-react.
• Nicer and consistent API. Easier to use.
• Not multiplatform. Optimized for Kotlin/JS instead.
• No dependencies beside React [Router].
• Lower size and performance overhead.
• More type safety, esp. around hooks.
• Props allow class
instead of just external interface
.
• Highly experimental. IR compiler only. Relies on unofficial compiler behavior.
Anyone wants to join the project? 😄
https://github.com/fluidsonic/fluid-reactMarc Knaup
11/29/2020, 6:32 PMMarc Knaup
11/29/2020, 6:34 PMandylamax
11/29/2020, 11:30 PMkotlin-react
I have no problems with kotlin-styled
at all, its syntax was so concise.
I considering joining you i this oneBig Chungus
11/29/2020, 11:31 PMandylamax
11/29/2020, 11:55 PMandylamax
11/30/2020, 12:08 AMval PriceCard : RComponent<PriceCardProps> by react.component { props->
// . . .
}
looks so much better than
val Component:RComponent<PriceCardProps> = react.component("PriceCard"){props->
// . . .
}
Marc Knaup
11/30/2020, 9:50 AMWhile I am also not happy with kotlin-react I have no problems with kotlin-styled at all, its syntax was so concise.
I considering joining you i this oneInteresting. I was particularly unhappy with
styled
which is why I’ve written my own CSS library.Marc Knaup
11/30/2020, 9:50 AMMarc Knaup
11/30/2020, 9:54 AMval PriceCard : RComponent<PriceCardProps> by react.component { props->
// . . .
}
You can.
I don’t use that in my project for two reasons:
a) My components are private. I expose wrapper functions like this:Marc Knaup
11/30/2020, 9:55 AMBig Chungus
11/30/2020, 10:34 AMMarc Knaup
11/30/2020, 10:55 AMkotlinx-html
targets pure HTML. There are several issues open for kotlin-react
and kotlinx-html
due to incompatibility with React.
React expects different casing for properties (DOM camel case instead of lowercase), different types (DOM types e.g. booleans, integers, etc.) and there are some React specifics (e.g. style
being an object).
Given enough time it may be possible to write a generator, but I don’t think it’s worth it.christophsturm
11/30/2020, 11:39 AMMarc Knaup
11/30/2020, 11:41 AMandylamax
11/30/2020, 10:35 PMandylamax
11/30/2020, 10:38 PMkotlinx-html
Marc Knaup
11/30/2020, 10:52 PMby
in the suggestion 😄
But delegation adds quite some overhead. Also the name cannot be removed from production builds then – they’re only supposed to be used in debug builds.Marc Knaup
11/30/2020, 10:53 PMMarc Knaup
11/30/2020, 10:53 PMexternal
& inline
are like all-purpose optimization tools 🙂Marc Knaup
11/30/2020, 11:26 PMandylamax
12/01/2020, 12:04 AMMarc Knaup
12/01/2020, 12:46 AMMarc Knaup
12/01/2020, 12:56 AMBjörn Mayer
12/01/2020, 9:44 AMDslMarkers
which is almost impossible with the current split between builder and components. Hence I came up with this:
rootDiv.reakt {
+TestComponent(prop1 = "Test") {
+TestComponent(prop1 = "Test3") {
+Div("test4") {
attrs {
id = "test"
}
}
}
+"Lol"
+TestComponent()
}
}
class TestComponent(
prop1: String = "lol",
handler: ReaktBase.ReaktHandler<TestComponent> = ReaktBase.ReaktHandler { }
) : Component<TestComponent, TestComponent.Props>(handler) {
...
}
It’s neither working yet, nor is it commited somewhere. And I am not sure if I want to follow this path.
Seeing your project gives me hope though, that we will have a nice to use dsl for react in kotlin.Big Chungus
12/01/2020, 9:51 AM