Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
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
240
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
360
Getting Started With Data Structures
adoranwodo
1
510
StereoKit: The Open Source SDK for VR/MR
adoranwodo
0
230
Accessibility in the context of Mixed Reality
adoranwodo
0
120
Skills to Excel in Cloud Engineering
adoranwodo
0
490
The Opportunities In The Decade Of Mixed Realities
adoranwodo
0
130
7 Habits of Highly Effective Engineering Teams
adoranwodo
0
250
Designing secure cloud applications
adoranwodo
0
250
Building a sustainable personal brand
adoranwodo
0
190
Other Decks in Programming
See All in Programming
【加筆修正版】Laravel のアプリケーションをどこにデプロイするか #phpcon_ehime
akase244
0
160
Groovy as a human and AI friendly programming language
paulk
0
100
IBM Bob Dojo #1 仕様駆動開発入門
oniak3ibm
PRO
0
410
dotNET_vulnclicker_intro.pdf
deka_morita
0
150
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
300
當我們開始不讀 Code - AI Agent 時代,Code Review 與 Clean Code 還剩下什麼?
jame2408
1
300
AIで開発が速くなった先で、開発チームは何を目指すか
shihochan
1
1.7k
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
1k
SalesForceを内製化!? ~ HR事業を支える顧客管理基盤のインフラを大公開 ~
oku053
0
190
sbt 2.0: takeoff
eed3si9n
0
170
graphql-ruby を Spinel で速くしようとした話
mtsmfm
0
110
PumaからFalconに移行したRailsアプリケーションでの実践
falcon8823
0
200
Featured
See All Featured
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
Designing Experiences People Love
moore
143
24k
Everyday Curiosity
cassininazir
0
360
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.4k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Building Adaptive Systems
keathley
44
3.3k
Building Applications with DynamoDB
mza
96
7.2k
Documentation Writing (for coders)
carmenintech
77
5.6k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
570
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