1

I have a function that receives a Dynamic and has to display a dom element which will contain a different kind of child depending on the value in the Dynamic. Is there a way to do such thing using Reflex and Reflex-Dom? The code would look like this if the value in the dynamic could be unwrapped by pattern matching:

myNode :: MonadWidget t m => Dynamic t Bool -> m (Event t ())
myNode (Dynamic True) = elClass "div" "foo" $
  elClass "div" "bar"
myNode (Dynamic False) = blank
Jesuspc
  • 1,664
  • 10
  • 25

1 Answers1

1

I've found the solution. The function dyn can be used in those situations. Also see this other stackoverflow question.

Jesuspc
  • 1,664
  • 10
  • 25