You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
752 B

4 years ago
  1. package com.example.playscalajsreact.component
  2. // import slinky.core.annotations.react
  3. // import slinky.core.StatelessComponent
  4. // import slinky.web.html.h1
  5. import japgolly.scalajs.react._
  6. // @react class HelloWorldComponentSlinky extends StatelessComponent {
  7. // case class Props(name: String, age: Int)
  8. // def render = {
  9. // h1(s"Hello ${props.name} ${props.age}")
  10. // }
  11. // }
  12. object HelloWorldSJSRComponent {
  13. import japgolly.scalajs.react.vdom.all._
  14. case class Props(name: String, age: Int)
  15. private val component = ScalaComponent
  16. .builder[Props]("HelloWorldComponent")
  17. .render_P(props => {
  18. p(props.name + " " + props.age)
  19. })
  20. .build
  21. def apply(name: String, age: Int) = {
  22. component(Props(name, age))
  23. }
  24. }