In the Attribute Passthrough chapter of the book, in the last code block we have
use sycamore::web::StringAttribute;
#[component(inline_props)]
fn Button(
#[prop(attributes(html, button))]
attributes: Attributes,
// StringAttribute is a type alias for MaybeDyn containing a string.
class: StringAttribute,
) -> View {
// We still want the attribute to be reactive.
let class = move || format!("{class} custom-button");
view! {
button(class=class, ..attributes)
}
}
But StringAttribute is a type alias for MaybeDyn<Option<Cow<'static, str>>> which didn't implement Display.
One possible solution will be to turn StringAttribute into a new type around MaybeDyn<Option<Cow<'static, str>>> (with Deref and DerefMut) and implement Display for it.
In the Attribute Passthrough chapter of the book, in the last code block we have
But
StringAttributeis a type alias forMaybeDyn<Option<Cow<'static, str>>>which didn't implementDisplay.One possible solution will be to turn
StringAttributeinto a new type aroundMaybeDyn<Option<Cow<'static, str>>>(withDerefandDerefMut) and implementDisplayfor it.