https://kotlinlang.org logo
#feed
Title
# feed
r

Robert Jaros

05/10/2020, 1:38 AM
I've released KVision 3.8.0 - https://github.com/rjaros/kvision. Highlights of this release: - added new
className
parameter to all DSL builder functions for better React-like HTML markup - simplified state binding functions - added root panel container types from Bootstrap 4.4 - upgraded dependencies: Coroutines 1.3.6, Spring Boot 2.2.7, Jooby 2.8.2, Bootstrap Select 1.13.17 For more details about this release see the changelog. As always any feedback is welcomed :-)
a

altavir

05/10/2020, 6:38 AM
I hav a thought that you should probably consider. I found it the hard way that React components are not quite what you want when you have a complicated logic, but still there are a lot of them and they are usually better quality than old-school jquery or plain JS. I think it is quite possible to make tha application in kvision and include separate react components in it. So the proposal is to add additional react componenent holder that just binds a react container through react-dom and looks like.
Copy code
react{/*this: RBuilder*/
  ...
}
r

Robert Jaros

05/10/2020, 9:53 AM
I'll think about this, but I have doubts if it's possible, because of separate virtual doms.
I'm not a react user - could you give me a sample of a react component you think of would be nice to integrate?
I've played a bit with the code and it really seems to work!
I've integrated
ReactPlayer
and
ReactShare
(based on play.kotlinlang.org tutorial code) into KVision app without problems
Thx for the idea 🙂 I'll try to refine this solution as a KVision module for the next version.
a

altavir

05/10/2020, 2:24 PM
Nice. I do not think that differend virtual doms will interfere as long as react container is bound to real dom element. As for components, I am currently trying to use material-ui components. Also it seems like recursive tree-like objects are much easier in react.
r

Robert Jaros

05/10/2020, 2:53 PM
Is there any general way to access state of the React component?
Or it's just a matter of some kind of specific callback functions inside
RProps
?
a

altavir

05/10/2020, 2:54 PM
Not from the outside. I wrote an aricle about that: https://itnext.io/taming-react-with-kotlin-js-and-coroutines-ef0d3f72b3ea. Such practices are frowned upon in JS society, but still it is possible to do.
I think it could work even better with new
StateFlow
.
r

Robert Jaros

05/10/2020, 3:00 PM
But if we are talking about external react components, we are simply dependent on the callbacks designed by the creator of the component, am i right?
a

altavir

05/10/2020, 3:02 PM
Yes. Sadly, React is just not designed to be accessed from the outside. The good thing is tha calling react-dom render on the DOM element should pass new props instead re-creating the whole Vdom.
4 Views