Hey, I really wish there were an example in how to...
# javascript
b
Hey, I really wish there were an example in how to use Kotlin multiplatform with NextJS. I'm fine if it compiles to WASM and Next reads that, but I wish this workflow was better supported. I think kotlin front-end for JS is super bad, so I wish I just used NextJS, Tailwind, Shadcn/ui, etc. But I think no one ever tried to do something like this.
c
When targeting Javascript for KMP, the entire app is rendered into an HTML
canvas
element. So you are free to put that
canvas
element anywhere within your site. There is no restriction on this.
b
Isn't there a simple way to just compile my functions? I don't want kotlin frontend because it is too bad.
d
Why too bad? What is the problem?
b
Well, I don't want to recreate the whell when js ecosystem is so good and complete compared to kotlin that has a react port and a lot of ports. Let me use the original one.
c
Yes, you can call from Kotlin to Javascript, and add any scripts or libraries as you normally would for any web application. There is no restriction on this. It’s also possible to call the Kotlin functions from the Javascript side. You can call javascript functions from the Kotlin side, and receive events from Javascript side to send to the Kotlin side. I’m not sure that’s the most efficient way of making an application, but when it needs to be done, its available. With KMP, you always have access to your native platform, either using Kotlin or Native API’s