fc.rs 714 B

12345678910111213141516171819202122232425262728293031323334353637
  1. use dioxus_core::component::fc_to_builder;
  2. use dioxus_core::prelude::*;
  3. use dioxus_core_macro::fc;
  4. use std::marker::PhantomData;
  5. static BLAH: FC<()> = |ctx, props| {
  6. let g = "asd".to_string();
  7. ctx.render(rsx! {
  8. div {
  9. SomeComponent {
  10. some_field: g
  11. abc123: 10,
  12. }
  13. }
  14. })
  15. };
  16. #[derive(PartialEq, Props)]
  17. pub struct ExampleProps {
  18. some_field: String,
  19. }
  20. static SomeComponent: FC<ExampleProps> = |ctx, props| {
  21. ctx.render(rsx! {
  22. div { }
  23. })
  24. };
  25. fn main() {}
  26. impl Properties for ExampleProps {
  27. type Builder = ExamplePropsBuilder<((),)>;
  28. fn builder() -> Self::Builder {
  29. ExampleProps::builder()
  30. }
  31. }