Skip to content

Instantly share code, notes, and snippets.

@anthony-cros
Created February 8, 2019 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anthony-cros/f89dd3eafc5ce05cc43ec59ef87b24ac to your computer and use it in GitHub Desktop.
Save anthony-cros/f89dd3eafc5ce05cc43ec59ef87b24ac to your computer and use it in GitHub Desktop.
...
val shoppingList = new ShoppingList()
Bindings.ReactDOM.render(
element = shoppingList, // js console ERROR: Uncaught Error: Objects are not valid as a React child (found: object with keys {props, context, refs, updater}). If you meant to render a collection of children, use an array instead
container = org.scalajs.dom.document.getElementById("container")) // sByClassName("myapp")(0)
}
@ScalaJSDefined
class ShoppingList(
jsProps: js.Object = js.Object.apply(),
context: js.Any = null,
updater: js.Any = null)
extends Bindings.Component() {
}
object Bindings {
...
@JSImport(/* module */ "react", /* name */ "Component", /* globalFallback */ "React.Component")
@js.native
class Component(
jsProps: js.Object = js.Object.apply(),
context: js.Any = null,
updater: js.Any = null)
extends js.Object {
val constructor: js.Any = js.native
def render(): js.Any = js.native
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment