How to conditionally render HTML with Scala and the Lift Framework


You have a piece of HTML like the following

and you want to hide the entire container if some condition is true.
Otherwise you want to display something inside the container.
Maybe populating an unordered list.

The key part is andThen because if you use the & chaining method, the CSS selectors are applied to the original template, no matter what other selectors you are using.
In contrast, with andThen you are composing two functions with the first being executed before the second.

Keep Learning.
Until next time