yew
yew copied to clipboard
Allow assigning &str and String to `Option<Html>`
While it is possible to assign &str and String to a property of type Html, that fails for Option<Html>. I think this should be possible too.
Yew: 0.21
Could you provide more context on what are you trying to assign them to?
Sure, something like this:
#[derive(PartialEq, Properties]
struct FooProperties {
pub title: Option<Html>,
}
#[function_component(Foo)]
fn foo(props: &FooProperties) -> Html {
html!(
if let Some(title) = &props.title {
<h1>{ title.clone () }</h1>
}
)
}
#[function_component(Example)]
fn example() -> Html {
html!(<Foo title="Title"/>)
}
The reason to use `