took a while but it works now : http://github.com/jhegedus42/irie/blob/dccf7ec4992a4372f809a11af727701b5d1e94a4/modules/client/src/main/scala/client/sodium/app/reactComponents/compositeComponents/CounterExample.scala#L27-L27
The meat of the code:
lazy val button = SButton("Inc")
val counter_ = Transaction.apply[CellTemplate[Int]]({ _ =>
lazy val afterUpdate: Stream[Int] = button.getClick.snapshot(counterValue, {
(_, c: Int) =>
c + 1
})
lazy val counterValue: CellLoop[Int] = new CellLoop[Int]()
counterValue.loop(afterUpdate.hold(0))
lazy val counter: CellTemplate[Int] = CellTemplate[Int](counterValue, { i =>
<.div(s"value is: $i")
})
counter
})
def getComp = {
val render: Unit => VdomElement = { _ =>
<.div(s"This is the counter example",
<.br,
counter_.getComp(),
button.vdom())
}