Yew: Allow `Option`s in html! class.

Created on 2 May 2020  路  3Comments  路  Source: yewstack/yew

Right now I need to write code like this:

html! {
    <div
        class=vec![
            Some("thing"),
            thing.new.as_some("new")
        ].iter().flatten().collect::<Vec<_>>()
    />
}

It'd be nice if I could just directly write

html! {
    <div
        class=vec![
            Some("thing"),
            thing.new.as_some("new")
        ]
    />
}

As well as the tuple version: class=((Some(thing), thing.new.as_some("new")).

feature

Most helpful comment

All 3 comments

https://github.com/yewstack/yew/pull/1085 ;)

I've never had negative time-to-implementation on a feature request before. :laughing: Amazing.

Sorry for the noise and thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  5Comments

wldcordeiro picture wldcordeiro  路  4Comments

FrontMage picture FrontMage  路  4Comments

thienpow picture thienpow  路  3Comments

ghost picture ghost  路  4Comments