1
0

event_nested.rs 468 B

12345678910111213141516171819202122232425
  1. #![allow(non_snake_case)]
  2. use dioxus::prelude::*;
  3. fn main() {
  4. dioxus_desktop::launch(App);
  5. }
  6. #[rustfmt::skip]
  7. fn App(cx: Scope) -> Element {
  8. // ANCHOR: rsx
  9. cx.render(rsx! {
  10. div {
  11. onclick: move |_event| {},
  12. "outer",
  13. button {
  14. onclick: move |event| {
  15. // now, outer won't be triggered
  16. event.stop_propagation();
  17. },
  18. "inner"
  19. }
  20. }
  21. })
  22. // ANCHOR_END: rsx
  23. }