Hi, I'm wonder if I could ask for some opinions. I...
# compose-web
s
Hi, I'm wonder if I could ask for some opinions. I've been working on an Android app for a couple of years that I ported to Compose. We started a web version of the app in Vue.js. I'm not very competent in JS (and even less so in Vue.js), but I'm quite comfortable with Kotlin and Compose. I'm contemplating using Compose for Web instead. Would my lack of JS skills be a big hindrance? I've written a Compose for Desktop app, but Compose for Web has the appearance of being much more daunting.
c
While I haven't personally used it, Compose for Web basically replaces Vue/React/Angular for the task of applying data to HTML. But you'll still need to know HTML/CSS to make a web app with it, just like with those other frameworks. Unfortunately, for the time-being, Compose just modifies normal browser DOM and doesn't use the Material UI (though I believe there is a long-term roadmap to support Skia and use Material UI like with Desktop), but I don't think you'd need to know much JS to work with Compose Web, just HTML/CSS. However, there are KMP libraries for most of the typical browser APIs you'd normally need (API clients, key-value storage, and routing, for example), so you don't have to drop down into that untyped hellscape called the JS Standard Library.
d
Yeah the heavy lift you'd need to do with Compose for Web, in its current state, is to 'Compose' your View layer from HTML+CSS. This isn't necessarily bad; it's perfectly feasible to build functional UI's from HTML elements and it does, mercifully, do away with a need to use JS at all. This already makes it a viable, even compelling tool for some use cases; particularly if you have a logic heavy client you want to share code between Mobile & Web.
s
Thanks for the replies. There's not really a lot of logic to be shared, I think. The biggest parts are the layout and data synchronization, which I guess would be quite different between web and mobile targets.
n
You might also consider Doodle; it doesn't require any HTML/CSS knowledge. Full disclosure: I'm the author. https://nacular.github.io/doodle
n
"Would my lack of JS skills be a big hindrance" - No. If you are comfortable with HTML/CSS then minimal Javascript knowledge may be enough. (Mainly for interfacing existing JS libraries.) Compose/Web works fairly well as a layer over the browser DOM. As others wrote, probably no canvas-based rendering will be available in the short term. But I think it is not a huge problem, for Compose/Web the main focus should be great integration with Web technologies (JS, CSS, DOM) and the ability to easily integrate existing JS libraries and eg. React components. I would definitely try it, at least evaluating if it fits your needs. It is a huge win that you can use Kotlin and Compose in the browser, with all "usual" frameworks and solutions (eg. coroutines). And some months ago a JB developer wrote that there may be a final version soon: https://kotlinlang.slack.com/archives/C01F2HV7868/p1625468108389900?thread_ts=1625426651.384800&cid=C01F2HV7868 To tell the truth, I would not use "custom" Kotlin frameworks, if you decide to not go with Compose/Web then maybe consider the ReactJS wrappers: https://github.com/JetBrains/kotlin-wrappers
s
@Norbi Thanks for your really detailed response. I don't mind HTML/CSS. It would be nice if I could use my existing components, but that's not possible with any other framework. I guess I could give it a try, the only thing to lose is some time.
👍 1
compose desktop 1
👍🏻 1
jetpack compose 1
g