fc.rs 630 B

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