Hi, trying to create wrapper for <react-checkbox-t...
# javascript
n
Hi, trying to create wrapper for react-checkbox-tree (npm link). Got error
Copy code
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of `Router.Consumer`.
More in thread.
1
My wrapper
Copy code
@file:JsModule("react-checkbox-tree")
@file:JsNonModule

package wrappers

import react.ComponentClass
import react.RProps

external interface TreeProps : RProps {
  var checked: Array<String>
  var expanded: Array<String>
  var iconsClass: String
  var nodes: Array<TreeNode>
  var onCheck: (Array<String>) -> Unit
  var onExpand: (Array<String>) -> Unit
}

external interface TreeNode {
  var value: String
  var label: String
  var children: Array<TreeNode>
}

@JsName("CheckboxTree")
external val CheckboxTree: ComponentClass<TreeProps>
t
1. Default export emulation required:
Copy code
@JsName("default")
external val CheckboxTree: ComponentClass<TreeProps>
2.
RProps
deprecated 3.
ReadonlyArray
preferred for properties 4. Related example
1
Related issues: • Pragmatic importModern export
Language
analogue - HashType (separate file required)
n
@turansky Thx, for your answer! Already tried this one, but forgot to clean build 🙃 .