Optional Arguments

When working with values that may or may not be provided, where the default is outside the range of possible provided values, you can improve your component's interface towards consumers by using optional arguments:

#![allow(unused)]
fn main() {
asteracea::component! {
  Classic()(
    class?: &'bump str,
  )

  <div
    .class? = {class} // `Option<_>`-typed!
  >
}

asteracea::component! {
  Classical()()

  [
    <*Classic> "\n"
    <*Classic .class = {"classicist"}> // Not `Option<_>`-typed!
  ]
}
}
<DIV></DIV>
<DIV class=classicist></DIV>

class is an Option<&'bump str> within Classics .render(…) method, but the parameter is provided from outside as &'bump str.