handler_thru_props.rs 553 B

12345678910111213141516171819202122232425262728293031323334
  1. #![allow(non_snake_case)]
  2. use dioxus::prelude::*;
  3. use dioxus_core as dioxus;
  4. use dioxus_core_macro::*;
  5. use dioxus_html as dioxus_elements;
  6. fn main() {
  7. let _ = VirtualDom::new(App);
  8. }
  9. fn App(cx: Context, _props: &()) -> Element {
  10. //
  11. cx.render(rsx!(
  12. div {
  13. Child {}
  14. }
  15. ))
  16. }
  17. struct ChildProps<'a> {
  18. click_handler: EventHandler<'a>,
  19. }
  20. fn Child(cx: Context, _props: &()) -> Element {
  21. //
  22. cx.render(rsx!(
  23. div {
  24. h1 {
  25. "Hello, World!"
  26. }
  27. }
  28. ))
  29. }