fc.rs 686 B

123456789101112131415161718192021222324252627282930313233343536
  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. }
  12. }
  13. })
  14. };
  15. #[derive(PartialEq, Props)]
  16. pub struct ExampleProps {
  17. some_field: String,
  18. }
  19. static SomeComponent: FC<ExampleProps> = |ctx, props| {
  20. ctx.render(rsx! {
  21. div { }
  22. })
  23. };
  24. fn main() {}
  25. impl Properties for ExampleProps {
  26. type Builder = ExamplePropsBuilder<((),)>;
  27. fn builder() -> Self::Builder {
  28. ExampleProps::builder()
  29. }
  30. }