yewstack / yew-autoprops

Apache License 2.0
8 stars 1 forks source link

#[autoprops_component] panics instead of making a proper error #3

Closed kirillsemyonkin closed 10 months ago

kirillsemyonkin commented 1 year ago

As of writing, yew-autoprops uses panic!() macro to display errors to the user. This, however, is not intended and causes jarring error:

#[autoprops_component]
pub fn Example(i: u32) -> Html {
    html! {}
}

#[function_component]
pub fn App() -> Html {
    html! {
        <Example i={ 0 } />
    }
}

Error:

custom attribute panicked
message: Invalid argument: i : u32 (must be a reference)

Possible Solutions