-
I have a custom button like this #[component]
pub fn IconButton(onclick: Option<EventHandler>) -> Element {
rsx!(
a {
onclick: move |event| if let Some(handler) = onclick{ handler.call(event)},
Icon {
... irrelevant stuff here ...
}
}
)
} Dioxus complains that the |
Beta Was this translation helpful? Give feedback.
Answered by
ealmloff
Apr 4, 2024
Replies: 1 comment 1 reply
-
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
wackazong
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
EventHandler
takes a generic argument for the parameter to the function. If you want to take a function that acceptsMouseEvent
as an argument, you can useEventHandler<MouseEvent>