({value}) => <li>{value}</li>
在 scalajs-react 中编写这个无状态反应组件的最简单方法是什么?
我在网上找到了以下相关链接,但他们没有回答这个问题:
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
这似乎是最接近答案的:
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}")
})
我不确定这是否是无状态的反应组件。
FunctionalComponent与无状态反应组件相同吗?
好的,似乎是:https ://gitter.im/japgolly/scalajs-react?at=575329dc9be9c5b637f074e8