scalajs-react

Is there a way of rendering a TagMod in a component


Say I have a table defined as follows:

val cols = Seq("One", "Two", "Three")

<.table(
  <.tbody(
    <.tr(
      rows.map(r => <.td(r)).toTagMod 
    )
  )
) 

And I want to wrap each row part in a component:

ScalaComponent.builder[Seq[String]]("Row")
  .render_P(r => rows.map(r => <.td(r)).toTagMod)
  .build

The code will not compile as render_P expects a VdomNode and not a TagMod. Is there of converting?


Solution

  • I figured out that I need to use toVdomArray in this context instead of toTagMod