fc.rs 842 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. use dioxus_core::prelude::*;
  2. use dioxus_core::scope::FC;
  3. use dioxus_core_macro::fc;
  4. use std::marker::PhantomData;
  5. // #[derive(PartialEq)]
  6. // pub struct Example<'a> {
  7. // b: &'a str,
  8. // ___p: std::marker::PhantomData<&'a ()>,
  9. // }
  10. // impl<'a> FC for Example<'a> {
  11. // fn render(ctx: Context<'_>, props: &Example<'a>) -> DomTree {
  12. // let Example { b, .. } = props;
  13. // {
  14. // ctx.render(rsx! {
  15. // div { "abcd {b}" }
  16. // })
  17. // }
  18. // }
  19. // }
  20. // always try to fill in with Default
  21. #[fc]
  22. fn Example(ctx: Context, a: &str, b: &str, c: &str) -> DomTree {
  23. ctx.render(rsx! {
  24. div {
  25. SomeComponent {
  26. a: "123"
  27. }
  28. }
  29. })
  30. }
  31. #[fc]
  32. fn SomeComponent(ctx: Context, a: &str, b: &str) -> DomTree {
  33. todo!()
  34. }
  35. fn main() {}