You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JSX is the part of react that everybody likes. It's too bad that Kotlin can't handle angle braces in identifiers, but that's not something that can change soon. Nevertheless, it'd be great if KVision could provide a way to get closer to the JSX flow of "build a component and include it as a tag".
Right now, the dsl that KVision provides is nice and fluent:
Instead, I have to call add(MyComponent()), which spoils the illusion of the dsl. I think it would be fine for components to have to implement a function in order to support this (rather than init, although init is nicer), but either way, would it be possible to think about a way to more seamlessly include components within the dsl in this manner? Maybe it could be done with receivers on a different entrypoint to root, so as to avoid breaking existing apps, e.g.:
I'm afraid Kotlin languague is not flexible enough. While you can inherit from a function type, you can't inherit from a function with a receiver type. If you have an idea how could this be implemented please share, but I can't think of any possibility.
A gradle task could scan for @component, and automatically create a bunch of extension functions that could be used in dsl. I think this would improve the readability of client code quite a bit.
JSX is the part of react that everybody likes. It's too bad that Kotlin can't handle angle braces in identifiers, but that's not something that can change soon. Nevertheless, it'd be great if KVision could provide a way to get closer to the JSX flow of "build a component and include it as a tag".
Right now, the dsl that KVision provides is nice and fluent:
However, while I can make my own component with minimal boilerplate using Kotlin's init:
...this does not work in KVision's dsl:
Instead, I have to call
add(MyComponent())
, which spoils the illusion of the dsl. I think it would be fine for components to have to implement a function in order to support this (rather than init, although init is nicer), but either way, would it be possible to think about a way to more seamlessly include components within the dsl in this manner? Maybe it could be done with receivers on a different entrypoint to root, so as to avoid breaking existing apps, e.g.:The text was updated successfully, but these errors were encountered: