Does anyone have experience with creating compose...
# compose-web
m
Does anyone have experience with creating compose-web wrappers for React components?
b
Why would you want to do that?? This would bloat your bundle size like crazy
This would be like wrapping angular components in react
m
Organisation has an existing component library for the design system, implemented in React
https://github.com/JetBrains/compose-jb/blob/master/examples/web-with-react/src/jsMain/kotlin/ReactInComposeApp.kt Found this example, but Im wondering if anyone knows how painful it is to work with
b
Then you'd better use kotlin react wrappers
m
But then I could’nt use compose?
b
Correct
m
And I want to use compose
b
Then don't use react. All I'm saying is that wrapping react into compose just makes no sense as then you'd have to ship two runtimes in your js bundle which will be crazy
m
Why is there a sample for it if its not feasible?
What makes you think I care about the bundle size? I might be building a kiosk application. At that point what does it matter?
b
Plus there will be countless of issues along the way to get those to sync up together. Just plain nightmare, best avoided.
The sample is there is just to show how compose can be integrated together with external systems. Probably following the Jetpack & CfD path of integrating with Swing and AndroidViews respectively.
But on the web, integrating with yet another framework would only make sense if you don;t target the browser with your app (which looks to be the case for you).
In that case go for it if you're really set on compose, just know that initial learning curve will be much higher than just using plain compose or plain react, because you'll need to understand some of the compose internals to integrate the two properly.
m
Well Ive got quite some experience with compose, primarily working on Android. After that I really really dont want to go back to React. Hopefully soon TM we will have canvas based rendering for web, where we can use cross platform composables. I figured until then it would be easier to wrap our React component library than implementing them in compose-web from scratch, only to be replaced by the android Compose variants ASAP
b
Looks like best option would be to just wait for canvas 😄 But I appreciate you might have reasons why you can't wait.
❤️ 1
m
Whats the latest news on canvas? Anything else than “at some point in the future”? 😅
b
One thing I could tell you from experience - HTML compose-web is quite different from Jetpack and CfD
Don't expect to "just pick it up" from day 1
Whats the latest news on canvas? Anything else than “at some point in the future”?
"At some point in closer future now" I guess 😄
I'm working on #kmdc components for compose-web if that helps at all, however it's still quite experimental.
h
I don't have experience with React in combination with Compose, but did you already use Kotlin in your React components? If so, keep in mind the styling library is different.