Create closure type; allow async event handlers in props; allow short hand event handlers (#2437)
* create closure type; allow async event handlers in props; allow shorthand event handlers * test forwarding event handlers with the shorthand syntax * fix clippy * fix imports in spawn async doctest
This commit is contained in:
1 parent
79e18c2d62
commit
d795995e20
11 files changed
+294
-103
No files matched your search
@@ -27,12 +27,18 @@ fn app() -> Element {
|
||||
}
|
||||
|
||||
#[component]
|
||||
fn Component(a: i32, b: i32, c: i32, children: Element, onclick: EventHandler) -> Element {
|
||||
fn Component(
|
||||
a: i32,
|
||||
b: i32,
|
||||
c: i32,
|
||||
children: Element,
|
||||
onclick: EventHandler<MouseEvent>,
|
||||
) -> Element {
|
||||
rsx! {
|
||||
div { "{a}" }
|
||||
div { "{b}" }
|
||||
div { "{c}" }
|
||||
div { {children} }
|
||||
div { onclick: move |_| onclick.call(()) }
|
||||
div { onclick }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user