japgolly / scalajs-react

Facebook's React on Scala.JS
https://japgolly.github.io/scalajs-react/
Apache License 2.0
1.64k stars 231 forks source link

ScalaFnComponent doesn't include displayName #1087

Open nafg opened 8 months ago

nafg commented 8 months ago

Here is my "userland" solution:

  implicit class withDisplayName[P, CT[-p, +u] <: CtorType[p, u]](self: ScalaFnComponent[P, CT]) {
    def withDisplayName(name: String) = {
      self.raw.asInstanceOf[js.Dynamic].displayName = name
      self
    }
    def withDisplayName(implicit name: FullName): ScalaFnComponent[P, CT] =
      withDisplayName(name.value.stripSuffix(".component"))
  }
nafg commented 8 months ago

Sorry I forgot about #1065 and created a new issue