General question about React and Kotlin: 1. how wo...
# react
i
General question about React and Kotlin: 1. how would you compare current state of
React + Kotlin
vs
React + JS/TS
? 2. Is it worth a hustle to use
React + Kotlin
only because I like
Kotlin
? 3. How mature it is in terms of tools and external libraries compatibility? 4. What are the main disadvantages currently?
m
1. I don’t know. Never used JS/TS React. 2. Yes. It’s amazing having a single ecosystem and not having to jump between programming languages. Removes a lot of mental burden. 3. Experimental I’d say. 4. Integration of external libraries is work (I prefer to stay all-Kotlin as much as possible). Not nearly as optimized as pure JS/TS performance- and size-wise.
👍 1
a
1. Putting in a score system •
React+TS
10/10 •
React+JS
9/10 •
React+KT
7/10 2. YES, YES, YES it is 3. Though experimentally, it is very mature. Caveat is that some react libs require a bit of work to be defined for use with
Kotlin+React
4. Bundle size and build time, and as @Marc Knaup pointed out. Intergration of external libs is work Additions 1. Using react in kotlin is ideal, but using code generated from kotlin to react is a bit hectic 2. libraries like ktor-client, serialization and coroutines will shoot the bundle size up 3. Using react hooks is still a bit verbose. But I am sure there is a compiler plugin in works to solve this issue Overall (Personal Opinion): If all you are looking to target is just web, then I suggest use TS for now, while ReaKT is still in the works. But if you intend to share code across Backend and frontend or accross web and mobile. It is totally worth the effort
m
btw, I’ve released my own React wrapper: https://github.com/fluidsonic/fluid-react More consistent API, less overhead, better bundle size & performance. Safer hooks. @andylamax what do you mean by that React hooks are verbose?
btw, to reduce the bundle size caused by ktor, coroutines, serialization, etc. you can load these parts lazily. Proof of concept for chunk splitting with Kotlin/JS: https://github.com/fluidsonic/kjs-chunks
c
i think typescript is also a pretty nice language, and its much easier to experiment with react in typescript than in kotlin. modern javascript + typescript is a very decent ecosystem
i learnt typescript in the last months because i was a frustrated with the kotiln react ecosystem. but others seem to love it. one show stopper is no decent test support. also with typescript you get much quicker turn around times
m
😂 I was all-in on Kotlin React because I was fed up by TypeScript and the JS ecosystem. Different scenarios I guess 🙂
c
in some months i will probably use only kotlin but i surely wont regret learning typescript
m
True, there’s a lot to learn from different languages, frameworks and concepts.
I do miss TypeScript’s union types in Kotlin 😉
c
this is a very inspiring article and probably the main reason i wanted to learn typescript: https://www.executeprogram.com/blog/porting-to-typescript-solved-our-api-woes
its really very dynamic typing, the utility types are also great