1
0

inlineprops.rs 805 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. //! Run with `cargo-expand` to see what each one expands to
  2. #![allow(non_snake_case)]
  3. use dioxus::prelude::*;
  4. #[inline_props]
  5. fn Thing1<T>(cx: Scope, _a: T) -> Element {
  6. cx.render(rsx! { "" })
  7. }
  8. #[inline_props]
  9. fn Thing2(cx: Scope, _a: u32) -> Element<'a> {
  10. cx.render(rsx! { "" })
  11. }
  12. #[inline_props]
  13. fn Thing3<'a, T>(cx: Scope<'a>, _a: &'a T) -> Element<'a> {
  14. cx.render(rsx! { "" })
  15. }
  16. #[inline_props]
  17. fn Thing4<'a>(cx: Scope<'a>, _a: &'a u32) -> Element<'a> {
  18. cx.render(rsx! { "" })
  19. }
  20. fn main() {
  21. dioxus_desktop::launch(app);
  22. }
  23. fn app(cx: Scope) -> Element {
  24. let state = use_state(cx, || 1);
  25. cx.render(rsx! {
  26. div {
  27. Thing1 { _a: 1 },
  28. Thing2 { _a: 1 },
  29. Thing3 { _a: state },
  30. Thing4 { _a: state },
  31. }
  32. })
  33. }