我使用scalajs-react已经有几个星期了,到目前为止我还没有使用过ReactComponentC.apply()的“ReactNodes”参数,因为我的子节点通常是在c.backend.render()中有条件地定义的。我做错了什么吗?在ReactComponentC.apply()中传递子节点有什么好处吗?在运行ReactComponentC.apply()之后,有没有办法动态地修改这个子列表?
基本上,我只是想知道将子代传递给ReactComponentB与在父组件的render方法中创建ReactComponentB的实例相比有什么优势。例如:
class Backend($: BackendScope[Props, State]) { //The backend class of the father
def render(p: Props, s: State) = {
ReactComponentB("Child") //I create the child directly in the render method (I didn't pass it as a Child.Varargs)
}
}https://stackoverflow.com/questions/42411821
复制相似问题