diff --git a/examples/simple_router.rs b/examples/simple_router.rs index 44a06040e..e674f2f30 100644 --- a/examples/simple_router.rs +++ b/examples/simple_router.rs @@ -24,9 +24,7 @@ enum Route { #[component] fn Homepage() -> Element { - rsx! { - h1 { "Welcome home" } - } + rsx! { h1 { "Welcome home" } } } #[component] @@ -52,6 +50,7 @@ fn Nav() -> Element { to: Route::Blog { id: "Brownies".to_string(), }, + onclick: move |_| { println!("Clicked on Brownies") }, "Learn Brownies" } } diff --git a/packages/core/src/properties.rs b/packages/core/src/properties.rs index 7dd7e8307..f660cafda 100644 --- a/packages/core/src/properties.rs +++ b/packages/core/src/properties.rs @@ -170,6 +170,17 @@ impl<'a> SuperFrom, OptionArgumentsFromMarker> for Option } } +#[doc(hidden)] +pub struct OptionHandlerMarker; + +impl SuperFrom + for Option> +{ + fn super_from(input: F) -> Self { + Some(EventHandler::new(input)) + } +} + #[test] #[allow(unused)] fn from_props_compiles() {