Skip to content

v0.5.0

Latest

Choose a tag to compare

@Madoshakalaka Madoshakalaka released this 16 Mar 20:02
3b0b092

MSRV raised to 1.85.0 to align with yew 0.23

Breaking

Reference types in function component signatures were ignored but now they will be copied to the generated struct. (#13 by @kirillsemyonkin )

This helps with ergonomics: the very ugly &&'static str pattern can be simplified to just &'static str now. So this compiles just fine now:

#[autoprops]
#[component]
pub fn Foo(bar: &'static str) -> Html {
  // ...
}

#[component]
pub fn App() -> Html {
    html! {
        <Foo bar="bar" />
    }
}

This is almost never breaking, unless you had this kind of code for some reason:

#[autoprops]
#[component]
pub fn Foo(bar: &'static String) -> Html { // the `&'static` used to be stripped by autoprops
  // ...
}

#[component]
pub fn App() -> Html {
    html! {
        <Foo bar={String::from("bar")} /> // so that you could just pass a `String`
    }
}

Now you have to pass some kind of Box::leak(Box::new(String::from("bar"))) fr fr