Kotlin for JavaScript

Learn how to use Kotlin to target the JavaScript platform in this workshop. You’ll learn how to use Kotlin multi-platform libraries as well as JavaScript libraries and frameworks. You’ll learn how to wrap existing JavaScript code in Kotlin and how to construct library wrappers automatically from TypeScript type definition files.


While creating a React application from scratch, you’ll learn how to use Kotlin effectively. 


What You’ll Learn

➜ How to use Kotlin to target the JavaScript platform

➜ Kotlin vs Java: What’s the difference?  

➜ Kotlin vs Java: Which is better for android development?

➜ Learn how to interoperate with JavaScript 

➜ Leverage coroutines for simple codes with Kotlin/JS


➜ We recommend that attendees of this course are comfortable with Kotlin and React development.

➜ Basic knowledge of JavaScript terminology is recommended.


Course Outline

Introduction to Kotlin for JS

  • Expanding Kotlin beyond the JVM
  • Differentiating the Legacy Compiler vs IR Backend
  • Supported platform templates in IntelliJ
  • JVM functionality not available in Kotlin/JS
  • Deconstructing a simple Kotlin/JS project
Interoperating with JavaScript
  • Working with the provided platform libraries
  • Interacting with the DOM and Browser APIs
  • Consuming Promise based APIs from Kotlin
  • Writing JavaScript module wrappers manually
  • Acknowledging the external keyword
  • Make use of the Any and dynamic types
  • The limitations of Kotlin wrapping JavaScript types
  • Auto-generating wrappers using dukat
React in Kotlin/JS
  • Examining the React DOM DSL
  • Attaching standard and custom attributes to elements
  • Writing class and functional components
  • Naming components for debugging
  • Use React Hooks and write custom hooks
  • Using delegation patterns for state
  • Writing DSL extensions
  • Understanding RProps for React props
  • The difference in functional components and extensions
A Deeper Look Into Kotlin/JS
  • Leveraging coroutines for simpler code
  • Understanding as and unsafeCast
  • When to apply jsObject
  • When to apply json
  • Writing inline JavaScript with js
  • Customising Webpack
  • Testing Kotlin/JS code