2

What is the easiest way to write this ({value}) => <li>{value}</li> stateless react component in scalajs-react ?

I've found the following related links on the net but they do not answer the question:

https://gitter.im/japgolly/scalajs-react?at=557e2a0dc030cae67ed3a4c3 https://github.com/japgolly/scalajs-react/blob/master/core/src/main/scala/japgolly/scalajs/react/ReactComponentB.scala#L41 https://gitter.im/japgolly/scalajs-react?at=561705054e0fa3e55447ba98 http://www.gitterforum.com/discussion/japgolly-scalajs-react?page=269 https://gitter.im/japgolly/scalajs-react?at=57ae33f90fd99f7041367604

This seems to be the closest to an answer:

https://gitter.im/japgolly/scalajs-react?at=575347a19be9c5b637f07a00

case class StatelessProps(name: String)
val stateless = FunctionalComponent((props: StatelessProps) => {
    <.span(s"My name is ${props.name}")
})

I am not sure though if this is a stateless react component or not.

Is FunctionalComponent the same as stateless react component ?

OK, it seems that it is : https://gitter.im/japgolly/scalajs-react?at=575329dc9be9c5b637f074e8

jhegedus
  • 20,244
  • 16
  • 99
  • 167
  • 1
    Since hooks, there isn't such a thing as a stateless component. It as a [misnomer](https://twitter.com/dan_abramov/status/1057625147216220162). – J. Hesters Mar 04 '19 at 12:29

0 Answers0