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
29 lines
752 B
package com.example.playscalajsreact.component
|
|
|
|
// import slinky.core.annotations.react
|
|
// import slinky.core.StatelessComponent
|
|
// import slinky.web.html.h1
|
|
import japgolly.scalajs.react._
|
|
// @react class HelloWorldComponentSlinky extends StatelessComponent {
|
|
// case class Props(name: String, age: Int)
|
|
|
|
// def render = {
|
|
// h1(s"Hello ${props.name} ${props.age}")
|
|
// }
|
|
// }
|
|
|
|
object HelloWorldSJSRComponent {
|
|
import japgolly.scalajs.react.vdom.all._
|
|
case class Props(name: String, age: Int)
|
|
|
|
private val component = ScalaComponent
|
|
.builder[Props]("HelloWorldComponent")
|
|
.render_P(props => {
|
|
p(props.name + " " + props.age)
|
|
})
|
|
.build
|
|
|
|
def apply(name: String, age: Int) = {
|
|
component(Props(name, age))
|
|
}
|
|
}
|