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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
210
Accessibility in the context of Mixed Reality
adoranwodo
0
100
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
【やさしく解説 設計編・中級 #1】一つの車に、運転手は一人 ~ある倉庫システムの事例から~
panda728
PRO
0
200
数百円から始めるRuby電子工作
tarosay
0
130
AWS CDK を「作」ってみた 〜フルスクラッチで見えた CDK の裏側〜 / aws-cdk-from-scratch
gotok365
3
2.8k
仕様書を書く前にハーネスを作る - Agent Native開発は「探索を速く、判定を固く」
gotalab555
4
1.5k
freee が目指す データ マネジメント戦略 AI-Ready 時代を支える 攻めのガバナンスとは
freee
PRO
0
250
自動化したのに回らないテスト運用の壁ーAI時代の品質責任と生産性
mfunaki
0
120
琵琶湖の水は止められてもNet--HTTPのリトライは止められない / You might be able to stop the water flow of Lake Biwa but you can't stop Net::HTTP retries
luccafort
PRO
0
550
VibeCodingからAgenticWorkflowへ
starfish719
0
220
OpenSpecのproposalにbrainstormingを持たせてみた
tigertora7571
1
200
Built Our Own Background Agent at LayerX
layerx
PRO
9
4.8k
php-fpmのプロセスが枯渇した日-調査・対処・そして本当にやるべきだったこと-
shibuchaaaan
0
210
JAWS-UG横浜 #102 AWSサ終供養LT会 成仏できない AWS サービスたち 〜本日、三体供養します〜
maroon1st
0
310
Featured
See All Featured
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Producing Creativity
orderedlist
PRO
348
40k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
230
Why Our Code Smells
bkeepers
PRO
340
58k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
240
WENDY [Excerpt]
tessaabrams
11
39k
Context Engineering - Making Every Token Count
addyosmani
9
1k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.6k
First, design no harm
axbom
PRO
2
1.2k
How STYLIGHT went responsive
nonsquared
100
6.2k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.9k
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