Calling Kotlin/React from javascript


#1

I’m trying to use Kotlin for building my React APP (https://github.com/JetBrains/create-react-kotlin-app). How can I call a function defined in the Kotlin class through the javascript function? How to set the module using create-react-kotlin-app?


#2

Kotlin code can’t be executed natively by your browser, so the Kotlin/JS compiler actually transpiles the code into Javascript. If you can find those JS files in your output, it should be as simple as importing the module by its path and calling the function by name, just as though you had written it in JS to begin with.