React-like applications with KorUI

25 Jul 2018

KorUI is a library part of Korlibs. It is used by KorGE to create a window and render things with KorAG. KorUI allows to create components easily in a platform-independent fashion. It has its own layout system supporting pixels and real-world units, but in the end it creates native components for each platform.

KorGE also allows to be embedded inside a KorUI Canvas control. And you can create a KorUI application inside KorGE rendering components via hardware too.

These days I have been experimenting how to create React-like applications using Kotlin and KorUI. So I have created a ReactComponent emulating how React works. You have a render function, and a typed state. In this case, you can use immutable data classes + copy.

The code looks like this:

Ah, and I have also added a ChartBars Context2d.Drawable component to KorIM. And KorUI supports rendering vector stuff automatically, so…: