Facebook Pixel

Kotlin for JavaScript Workshop

  • 2 Days
  • Intermediate
  • Virtual | Classroom
  • £ On Request

A rapid introduction to using Kotlin/JS to build React front-end applications

Book for my Team

What your team will learn

Understand where Kotlin/JS fits in the ecosystem

Learn how to use Kotlin to create front-end apps via React

Simultaneously leverage JavaScript (NPM) and Kotlin libraries

Interoperate with native JavaScript and write Kotlin wrappers

Overview

Kotlin is a superb choice for JVM development and the recommended language for Android. With Kotlin for JavaScript (Kotlin/JS) you can bring the power and simplicity of Kotlin to the JavaScript platforms.

In this course you will learn how to use Kotlin to target the JavaScript platform. You’ll see how to leverage JavaScript libraries and frameworks as well as Kotlin multi-platform libraries. You will learn how to write Kotlin wrappers around existing JavaScript code as well as auto-generate library wrappers from TypeScript type definition files.

This will all be accomplished by building a React application from scratch. This workshop is for a bleeding edge technology so best practices are still evolving, but we’ll draw on our wealth of experience from other platforms to guide you towards good project structure and coding practices. At the end of this course you’ll have a good appreciation of the pros and cons of Kotlin/JS and how to use it effectively.

This course requires that delegates are comfortable with both Kotlin and React development. We can combine this course with the required elements from our Kotlin and React courses.

Outline

Introduction to Kotlin for JavaScript

  • 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
  • Understanding the external keyword
  • Using 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

Going Deeper with 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

Requirements

Delegates must be confident Kotlin developers and have a good working knowledge of React. The course can be extended to include materials in either of these as required.

Ready to take the next step?

Instructor-led training for teams. Get in contact to learn more.

Book for my Team

Related Courses