• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Codemotion Magazine

Codemotion Magazine

We code the future. Together

  • Discover
    • Live
    • Tech Communities
    • Hackathons
    • Coding Challenges
    • For Kids
  • Watch
    • Talks
    • Playlists
    • Edu Paths
  • Magazine
    • Backend
    • Frontend
    • AI/ML
    • DevOps
    • Dev Life
    • Soft Skills
    • Infographics
  • Talent
    • Discover Talent
    • Jobs
  • Partners
  • For Companies
Home » Frontend » Mobile Developer » Kotlin loves React
Mobile Developer

Kotlin loves React

Codemotion and Facebook organized the Tech Leadership Training boot camp, heres a personal reportage from one of our attendees.

November 28, 2019 by Codemotion

In the beginning were the webmasters, who knew about PHP and JavaScript. Then front-end and back-end tribes, and each followed their own path, differentiating and specialising. Finally, new programming languages ​​and frameworks arrived, with the promise to write concise and expressive code, in safe mode.

Among the technologies that have emerged in recent years are, in particular, Kotlin and React. Developed internally by Jetbrains and Facebook respectively, released open-source and adopted by big companies all over the world, the two projects were born with similar purposes – offer a language / framework that allows to develop with more simplicity – and initially they were placed at the antipodes of the computer science rainbow. Kotlin, born to be an alternative to Java, wants to be an industrial-strength object-oriented language; React extends the JavaScript standard features to build user interfaces (within both browser and mobile OSs).

Two incompatible worlds? Not at all, two complementary worlds that, thanks to Kotlin‘s multi-platform peculiarities, are co-existing as a practical and winning solution to write both (web-based) front-ends and back-ends using one language.

A valid alternative on server side

At Codemotion Milan 2018, Davide Cerbo has introduced the advantages of using Kotlin for the realization of full-stack projects, showing how effective, in particular, is the current Kotlin-React combination.

Kotlin is a modern language for modern multi-platform applications. It is characterised in particular by the concise syntax and to be easily adopted by those who already know Java (it is not by chance that it runs on the JVM), but at the same time to offer some interesting solutions to carry out more solid projects. An example is the distinction between nullable and non-nullable data types and the obligation to use “null-safe” operators for nullable objects.

It is a language particularly suited for server side programming. Due to its JVM-based nature, it allows gradually migrating large codebases from Java to Kotlin, relying on existing frameworks such as Spring or Java EE Http servlets.

Recently, however, it has added the ability of transpilling the Kotlin code into JavaScript, in particular client-side JavaScript.

Modern web with Kotlin and React

Kotlin’s attention to the JavaScript world and in particular client-side JavaScript on browsers, manifests itself on several fronts. For example, in the DSL to build HTML in the DOM and in its ability to generate JavaScript that is compatible with the Asynchronous Module Definition (AMD), the CommonJS and the Universal Model Definition (UMD).

Not only. It is also possible to include and extend existing JavaScript libraries as they were Kotlin classes.

For a modern web application you need a modern framework and React is the most obvious choice for the Kotlin world. There are several Kotlin wrappers to common JS and React libraries such as React itself, Mocha and Redux.

Of course, there are some subtle differences writing React code in Kotlin compared to JavaScript. For instance, being a strictly-typed language, type annotations for props are not optional.

Surely interesting, as highlighted by Davide Cerbo in his talk, is the possibility of “reusing” the same classes and methods in the front-end and in the back-end, with the certainty of having the same behaviour in both cases. Of course, the actual code will run, for instance, over JVM on server side and inside the browser’s JavaScript engine on client side.

Do not forget, however, that JavaScript code is transpilled from original Kotlin code and that, in some respects, Kotlin is very far from how JavaScript works. In particular, it should not be overlooked that, while Kotlin is a static typed language, JavaScript is dynamic-typed. This entails particular attention in using certain advanced constructs.

The path of Kotlin and React has just begun, but it’s already promising for multi-platform and full-stack development situations.

facebooktwitterlinkedinreddit
Share on:facebooktwitterlinkedinreddit

Tagged as:Android Codemotion Milan Kotlin React

From artificial intelligence to generative deep learning
Previous Post
Is there a glass ceiling for women in tech?
Next Post

Related articles

  • Native vs Hybrid: Which Mobile App Platform Should You Choose?
  • Kotlin Users Group – Interview with organiser, Jakub Jablonski
  • Async code on Kotlin: coroutines VS RxJava
  • Become a Mobile Developer and Connect the Virtual and Physical Worlds
  • Flutter for Android Developers explained by Faisal Abid
  • 5 Mobile App Predictions for 2020
  • Building mobile applications in JavaScript with React Native
  • Facebook Hermes becomes open source
  • The state of Developer Ecosystem in 2019: the rise of Kotlin and React
  • XPay Mobile App: integrazione con Google Pay e Apple Pay

Primary Sidebar

Learn new skills for 2023 with our Edu Paths!

Codemotion Edu Paths for 2023

Codemotion Talent · Remote Jobs

Game Server Developer

Whatwapp
Full remote · TypeScript · Kubernetes · SQL

Back-end Developer

Insoore
Full remote · C# · .NET · .NET-Core · Kubernetes · Agile/Scrum

Full Stack Developer

OverIT
Full remote · AngularJS · Hibernate · Oracle-Database · PostgreSQL · ReactJS

Data Engineer

ENGINEERING
Full remote · Amazon-Web-Services · Google-Cloud-Platform · Hadoop · Scala · SQL · Apache-Spark

Latest Articles

Will Low-Code Take Over the World in 2023?

Frontend

Pattern recognition, machine learning, AI algorithm

Pattern Recognition 101: How to Configure Your AI Algorithm With Regular Rules, Events, and Conditions

AI/ML

automotive software

Automotive Software Development: Can Agile and ASPICE Coexist?

DevOps

programming languages, 2023

Which Programming Languages Will Rule 2023?

Infographics

Footer

  • Magazine
  • Events
  • Community
  • Learning
  • Kids
  • How to use our platform
  • Contact us
  • Become a Contributor
  • About Codemotion Magazine
  • How to run a meetup
  • Tools for virtual conferences

Follow us

  • Facebook
  • Twitter
  • LinkedIn
  • Instagram
  • YouTube
  • RSS

DOWNLOAD APP

© Copyright Codemotion srl Via Marsala, 29/H, 00185 Roma P.IVA 12392791005 | Privacy policy | Terms and conditions

Follow us

  • Facebook
  • Twitter
  • LinkedIn
  • Instagram
  • RSS

DOWNLOAD APP

CONFERENCE CHECK-IN