Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Kotlin with JavaScript & React: A Reality
Search
Adora Nwodo
July 06, 2019
Programming
220
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Kotlin with JavaScript & React: A Reality
Adora Nwodo
July 06, 2019
More Decks by Adora Nwodo
See All by Adora Nwodo
Harnessing the Power of AI in Open-Source Cloud Engineering
adoranwodo
2
350
Getting Started With Data Structures
adoranwodo
1
500
StereoKit: The Open Source SDK for VR/MR
adoranwodo
0
220
Accessibility in the context of Mixed Reality
adoranwodo
0
110
Skills to Excel in Cloud Engineering
adoranwodo
0
470
The Opportunities In The Decade Of Mixed Realities
adoranwodo
0
130
7 Habits of Highly Effective Engineering Teams
adoranwodo
0
240
Designing secure cloud applications
adoranwodo
0
240
Building a sustainable personal brand
adoranwodo
0
180
Other Decks in Programming
See All in Programming
Go を使い始めて 2 ヶ月の学び / My first two months with Go
contour_gara
0
380
使いながら育てる Claude Code — 開発フローの1コマンド化 × 繰り返し指摘の自動仕組み化
shiki_kakaku
1
2k
freeeにおけるEvalsの実践例の紹介
freee
PRO
0
150
生成AIで帳票OCRが「簡単に」作れる時代になった?
kon_shou
0
1.2k
複数の Claude Code が"放置"されてしまう問題をCLI ダッシュボードを自作して解決した話
sumihiro3
1
730
Hono + Inertia + React で LP を構築した話
oukayuka
2
170
まだ間に合う!今年の夏こそSchemeのマクロ展開器を完全理解!
omasanori
0
500
人間の目はかわらない、だからJPEGは30年もつ
yuzneri
12
19k
komatsuna「分散システムにおけるバグ分析手法」
komatsunaqa
0
280
わからない話を追いかけたら、プログラミング言語を作る側にいた
ydah
3
550
ALB ログから Trace を気合で繋げる技術
fohte
6
630
AWS DevOps AgentのAzure接続機能を検証して見えた活用法/Use Cases Verified for the AWS DevOps Agent's Azure Connectivity Feature
masakiokuda
1
270
Featured
See All Featured
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
380
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.1k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2.1k
We Are The Robots
honzajavorek
0
310
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
360
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Code Reviewing Like a Champion
maltzj
528
40k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.8k
Documentation Writing (for coders)
carmenintech
77
5.5k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3k
Transcript
KOTLIN WITH JAVASCRIPT & REACT: A REALITY
Hi, I’m Adora Software Engineer Creator, adorahack.com Co-organizer GDG Ajah,
Unstack, Android Ngr Twitter: @theadoranwodo YouTube: adorahack
KOTLIN ?
Kotlin is a cross-platform, statically typed, general-purpose programming language with
type inference.
WHY KOTLIN FOR JAVASCRIPT?
You’re not a fan of comparisons in Javascript '' ==
false 0 == false 0 === false null === undefined null == undefined null >= 0
Interoperability index.js function getToken(){ // do some stuff here //
return a token string } Main.kt val TOKEN = js("getToken()") as String
Kotlin is modern & easy to learn.
Share code between platforms
KOTLIN & REACT
Create React Kotlin App. npm install -g create-react-kotlin-app Kotlin React
Wrapper. npm i @jetbrains/kotlin-react
Lambdas are used in place of JSX when doing React
with Kotlin
const Message = ({ message}) => { if (message )
{ return ( <div>Hey, {message}</div> ); } return null } Functional Components - Message.js
fun RBuilder.alert(message: String = "") = if (message.isNotEmpty()) { div{
+ “Hey, $message” } } else { empty } Functional Components - Message.kt
• RComponent • RBuilder • RState • RProps • RActions
• rEnhancer Some things to remember
interface WelcomeProps: RProps { var name: String } class Welcome:
RComponent<WelcomeProps, RState>() { override fun RBuilder.render() { div { +"Hello, ${props.name}" } } } fun RBuilder.welcome(name: String = "John") = child(Welcome::class) { attrs.name = name } Class Components (Welcome.kt) Code snippet from https://github.com/JetBrains/kotlin-wrappers/tree/master/kotlin-react
Reusing Components Code snippet from https://github.com/JetBrains/kotlin-wrappers/tree/master/kotlin-react fun RBuilder.welcome(name: String =
"John") = child(Welcome::class) { attrs.name = name }
OTHER KOTLIN WEB WRAPPERS
kotlin-css & kotlin-styled DSL for creating stylesheets in Kotlin. npm
i @jetbrains/kotlin-css npm i @jetbrains/kotlin-css-js npm i @jetbrains/kotlin-styled
kotlin-mocha If you want to test, use this guy. npm
i @jetbrains/kotlin-mocha
kotlin-react-dom Kotlin wrapper for the React DOM library. npm i
@jetbrains/kotlin-react-dom
kotlin-react-redux Kotlin wrapper for the React Redux library. npm i
@jetbrains/kotlin-react-redux
kotlin-react-router-dom Kotlin wrapper for the React Router DOM library. npm
i @jetbrains/kotlin-react-router-dom
kotlin-redux Kotlin wrapper for the Redux library. npm i @jetbrains/kotlin-redux
• Introduction to Kotlin • Why Kotlin for JavaScript •
Kotlin in React • Existing Kotlin JS wrappers Summary
• https://kotlinlang.org/docs/reference/js-overview.html • https://github.com/JetBrains/kotlin-wrappers • https://github.com/JetBrains/create-react-kotlin-app • https://adorahack.com Helpful resources
Build for the web however you like!
THANKS! Website: adoranwodo.com Blog: adorahack.com Twitter: @adoranwodo