Do you know a library like react but with Kotlin ?
# javascript
m
Do you know a library like react but with Kotlin ?
k
m
Ok, I'm looking for a full kotlin solution. If react change, my code will be obsolete if wrapper are not updated.
k
If react gets changed, all client code becomes obsolete
I think FB will never do something like that
m
Yes, you're right but if I can avoid this risk with a full kotlin framework. Thanks
l
k
You can also avoid this by not updating react then? Kotlin frameworks will have the same "problem".
m
I don't see your point with "Kotlin frameworks will have the same "problem""
k
You say that if react changes your code will break, the same can be said for every library, including Kotlin ones.
m
Yes, of course. Try to avoid this. In this case, wrapper is an additional actor which can include regression, breaking changes...
s
I'm working on Kotlin React wrapper with yet another approach (generally inspired by Flutter). Component will looks like this:
Copy code
class MyPage(key: String) : PureWidget(key) {
  override fun render() = Column {
    +Text(
        text = "Page title",
        style = TextStyle(
            fontSize = 24.0,
            fontWeight = bold
        )
    )

    +Container(margin = Insets(leftRight = 10.0)) {
      +Row {
        +Container(padding = 10.allSides) {
          +Column {
            +BulletList {
              +MenuItem("1", "About")
              +MenuItem("2", "Documentation")
            }
          }
        }
      }
    }
  }
}

class MenuItem(
    key: String,
    val title: String
) : PureWidget(key) {
  override fun render() = ListItem {
    +Text(color = 0xFF0000.rgbColor) {
      +MouseListener(click = ::click) {
        +title
      }
    }
  }

  private fun click(mouseEvent: MouseEvent) {
  }
}
The main difference is that the components are defined with immutable properties. Effectively Widgets is React.Props. If you are interested with that I can push it to github and write some docs.
b
@snrostov sounds interesting, I’d take a look
s
I'll try to post on this week
👍 1
You can see examples here: https://htmlpreview.github.io/?https://raw.githubusercontent.com/snrostov/ui-dsl/master/index.html#hello-world For now documentation is only in Russian. Sorry, no enough time to translate it into English for now. https://github.com/snrostov/ui-dsl