
Create React apps using Kotlin - mihau
https://github.com/JetBrains/create-react-kotlin-app
======
maxfurman
Does this mean that Kotlin -> React -> React Native is feasible too? It's a
bit ridiculous on its face, but is there a better way to run Kotlin on iOS?
Kotlin is a godsend for Android but if you have to support both platforms one
codebase is better

~~~
on_and_off
Kotlin Native is what you are looking for.

Or maybe j2Objc

One codebase for both platforms is not necessarily what you want though.

Let me rephrase, it might be what you want for a pretty small app : if you
have to create an app for a restaurant with orders and menu, a cross platform
solution is probably the best use of your time.

For anything bigger, it becomes a harder sell. All these solutions tend to
have the same downsides :

\- limited access to new platform features. Especially damaging when Apple
tells you that you are going to get featured if you do a Watch app but your
SDK does not support that yet.

\- one design does not scale well to two platforms with different UX and
features.

\- one more layer of abstraction to manage; making maintainability harder

I think that there is clearly a space for a cross platform business logic
framework though. It tends to be the same on both platform with minor
differences. It is a pity that only j2objc seems to clearly target this.
k2objc/swift would be awesome.

~~~
maxdo
Don’t mix platform and language. Having same language is just 5% of one
platform for iOS android and windows. Weex gives also web mobile support btw.

------
uglycoyote
How is the debugging experience? Is there a debugging experience?

I'm currently a typescript user and I like what VS code has going on with
attaching to chrome and providing debugging within the ide. Source maps are
okay but a seamless experience in the source language is better. Does the
kotlin IDE have facilities for debugging what is going on in the browser?

~~~
specialist
Being a grumpy old man: it's not programming if I can't set a breakpoint.

~~~
bitL
Talk to functional programming folks... :D

~~~
yawaramin
Or not, we do printf debugging ... :-)

------
bitL
Can I use this outside IntelliJ (Atom perhaps)? I despise JavaScript, GWT is
underwhelming and Kotlin seems like a nice way to bypass these issues + React
is becoming a de-facto standard. IntelliJ became too big/slow/feature creeped
and I am not having good time with the latest code completion changes, so I am
considering dropping it (PyCharm as well) for something more light-weight.

~~~
nameless912
> React is becoming a de-facto standard

The Vue.JS community would beg to differ.

But yeah, if JetBrains could implement something like the Rust Language Server
for Kotlin I would be so happy.

~~~
warent
Agreed with this. I use both React and Vue intensively, day to day. React and
Vue both have pros and cons, but I would argue it's actually easier to
optimize Vue apps.

Vue's reactive nature actually is superior, because something like Redux
requires destroying, regenerating, and messaging around entire objects. This
can create serious problems when, for example, trying to use Chrome APIs or
manage component renders.

Also, although JSX is nice for developers, it's not friendly to designers.
Vue, however, supports single file components that are very designer-friendly.

FWIW, Alibaba began creating their own native framework with Vue called Weex,
which is now part of the Apache project.
[https://weex.apache.org/](https://weex.apache.org/)

~~~
yawaramin
Redux is not actually necessary for React, you can manage state without it.

------
jm547ster
I was trying to get this setup going the other day and found it a little
fiddly with some of the Jetbrain’s documentation on Kotlin->JS being outdated
it seemed and the sample application they have supplied having some issues
with missing dependencies, specifically missing package versions on NPM. I’ll
be trying this out straightaway, so many thanks for this!

~~~
specialist
What's the fix to config mgmt jitter, entropy?

Every time I set aside a few hours to do a React tutorial, I'm defeated by the
stack.

I'm very late to docker. I always liked the idea, but didn't have the
immediate need. But Python, trying to fix bugs in someone else's project, has
now made that need urgent.

After spending WAY TOO MUCH TIME getting the exact right constellation of
stuff installed. Switching from macports to homebrew, preinstalling the native
libs, wiping all the misc failed python runtimes and starting over,
bootstrapping pip, oops I screwed up once with sudo and now a hidden cache
under /var/private/root is borking dependency resolution.

FFS.

I really hated Java & maven until I got a nodejs gig.

I really hated nodejs & npm until I had to fix someone else's python.

When does it get better?

Nix everywhere?

~~~
bitL
I think Vagrant is for reproducible development environments.

~~~
hackerfromthefu
That's the theory ..

------
glued
Why use this over TypeScript?

~~~
lf-non
Primarily because Kotlin is not a superset of javascript and thus does not
inherit the quirks of javascript.

Other than that, if your backend is kotlin then you can potentially share (non
JVM dependent) business logic code with the backed. Same goes for android
clients. Same interfaces can be be used in client and server.

~~~
jrs95
I've never really found a good use case for reusing business logic, but just
reusing types is pretty helpful. Although you can also get that via something
like Swagger as well.

~~~
lomnakkus
I too am more of a fan of the Swagger/OpenAPI approach (in general terms), but
I find it valuable to be able to share validation logic too. (Unless your
validation requirements are extremely simple.)

Of course Swagger/OpenAPI doesn't _preclude_ using the same language on the
client and server side, so one could always combine "isomorphic" approach with
the "service definition" approach.

------
matrix
Intriguing approach. Anyone know if there's a write-up somewhere from somebody
that's tried it? It's always helpful to learn from the gotchas others have run
into.

~~~
adamnemecek
JS as a compilation target is supported by kotlin out of the box. You can use
any js framework and IIRC it even understands typescript type annotations. I'm
super pumped about kotlin, can't wait to write a whole app, backend and front-
end in it.

~~~
kevinSuttle
Wow. I had no idea. That’s great to know. Thanks for relaying that info. Do
you have any further resources you recommend with regards to this?

~~~
adamnemecek
Here's a whole stack app built by JetBrains themselves in Kotlin with React
for front end [https://github.com/Kotlin/kotlin-fullstack-
sample](https://github.com/Kotlin/kotlin-fullstack-sample)

~~~
kevinSuttle
Nice! Thanks.

------
danthejam
So the kotlin code gets compiled to Javascript or to Java bytecode?

~~~
jrudolph
both: JVM Target -> Java bytecode, Browser Target -> Javascript

