Hello everyone! I’m trying to pass a Kotlin React ...
# javascript
l
Hello everyone! I’m trying to pass a Kotlin React Component into another function from the
react-redux
library, but I keep getting the error:
You must pass a component to the function returned by connect.
Copy code
val connected = connect(
        ::mapStateToProps,
        ::mapDispatchToProps
)


fun RBuilder.AppContainer() {
    div {
        connected(App()) // Pass Component Here
    }
}
What would the correct syntax be to pass this component to the
connected
function? Note: I’m just using the App Component from the
create-kotlin-react
repo that looks like this:
Copy code
class App : RComponent<RProps, RState>() {
    override fun RBuilder.render() {
        div("App-header") {
            logo()
            h2 {
                +"Welcome to React with Kotlin"
            }
        }
        p("App-intro") {
            +"To get started, edit "
            code { +"app/App.kt" }
            +" and save to reload."
        }
        p("App-ticker") {
            ticker()
        }
    }
}

fun RBuilder.app() = child(App::class) {}
b
@Filipp Riabchun @houston could you please help
f
You need to pass js constructor. AFAIR, it's
App::class.js
l
That seems to be the trick. Thank you so much!