1

I want to use react-infinite-grid in Kotlin http://ggordan.com/post/react-infinite-grid.html

I have seen the How to import node module in React-Kotlin?

Below code is my reference it:

InfiniteGrid.kt

@file:JsModule("react-infinite-grid")
@file:JsNonModule
package react.infinite.grid

import react.*

external interface InfiniteGridProps: RProps {
    var wrapperHeight: Int
    var entries: Array<*>
}

@JsName("default")
external val InfiniteGrid : RClass<InfiniteGridProps>

main.kt

package index

import kotlinext.js.*
import react.dom.*
import kotlinx.browser.*
import react.infinite.grid.InfiniteGrid

fun main(){
    requireAll(require.context("src", true, js("/\\.css$/")))
    render(document.getElementById("root")) {
        InfiniteGrid{
            attrs.wrapperHeight = 400
            attrs.entries = arrayOf(1, 11, 111, 1111)
        }
    }
}

But, I have error:

Error: Element ref was specified as a string (wrapper) but no owner was set. This could happen for one of the following reasons:

  1. You may be adding a ref to a function component
  2. You may be adding a ref to a component that was not created inside a component's render method
  3. You have multiple copies of React loaded See https://reactjs.org/warnings/refs-must-have-owner.html for more information.

enter image description here

I tried How to import node module in React-Kotlin? two way is not success.

Please Help To Me

Thank You


Update:

I finded is react-infinite-grid cannot support react 16.0.0 or newer.

With Kotlin Wrap No relation.

1
  • Your code looks correct (except the entries part). Have you tried rendering with an empty array for entries? Commented Sep 28, 2020 at 12:18

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.