fc.rs 730 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. type StaticOutput = ExampleProps;
  26. fn builder() -> Self::Builder {
  27. ExampleProps::builder()
  28. }
  29. unsafe fn into_static(self) -> Self {
  30. self
  31. }
  32. }