Hey, I am trying out create-react-kotlin-app and s...
# javascript
r
Hey, I am trying out create-react-kotlin-app and struggling a bit with usage of js components from kotlin. For example, in my project I have a file
src/app/App.js
and
src/index/index.kt
. App.js exports a react component which I want to render in index.kt. How do I do this? index.kt
Copy code
package index

import kotlinext.js.*
import react.dom.*
import kotlinx.browser.*


fun main(args: Array<String>) {
    requireAll(require.context("src", true, js("/\\.css$/")))

    render(document.getElementById("root")) {
        // Need to render App.js here
    }
}
App.js
Copy code
import React from "react";

function App() {
    return (
        <div>
            <span>Hello World!</span>
        </div>
    );
}

export default App;