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.

53 lines
1.1 KiB

4 years ago
  1. package com.example.playscalajsreact.model
  2. import japgolly.scalajs.react._
  3. import japgolly.scalajs.react.vdom.html_<^._
  4. object Top {
  5. final case class Props() {
  6. @inline def render: VdomElement = Component(this)
  7. }
  8. //implicit val reusabilityProps: Reusability[Props] =
  9. // Reusability.derive
  10. final class Backend($: BackendScope[Props, Unit]) {
  11. def render(p: Props): VdomNode =
  12. <.div
  13. }
  14. val Component = ScalaComponent.builder[Props]("Top")
  15. .renderBackend[Backend]
  16. //.configure(Reusability.shouldComponentUpdate)
  17. .build
  18. def apply() = Component(Props())
  19. }
  20. import japgolly.scalajs.react._
  21. import japgolly.scalajs.react.vdom.all._
  22. object Test2 {
  23. final case class Props()
  24. //implicit val reusabilityProps: Reusability[Props] =
  25. // Reusability.derive
  26. final class Backend($: BackendScope[Props, Unit]) {
  27. def render(p: Props): VdomNode =
  28. <.div
  29. }
  30. private val Test2Component = ScalaComponent.builder[Props]("Test2")
  31. .renderBackend[Backend]
  32. //.configure(Reusability.shouldComponentUpdate)
  33. .build
  34. def apply(): VdomElement = Test2Component(Props())
  35. }
  36. object Test3 {
  37. Test2()
  38. }