step.rs 811 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. use dioxus_core::{component::Properties, prelude::*};
  2. fn main() -> Result<(), ()> {
  3. let p1 = SomeProps { name: "bob".into() };
  4. let _vdom = VirtualDom::new_with_props(Example, p1);
  5. Ok(())
  6. }
  7. #[derive(Debug, PartialEq, Props)]
  8. struct SomeProps {
  9. name: String,
  10. }
  11. static Example: FC<SomeProps> = |ctx, _props| {
  12. ctx.render(html! {
  13. <div>
  14. <h1> "hello world!" </h1>
  15. <h1> "hello world!" </h1>
  16. <h1> "hello world!" </h1>
  17. <h1> "hello world!" </h1>
  18. </div>
  19. })
  20. };
  21. // toodo: derive this
  22. impl Properties for SomeProps {
  23. type Builder = SomePropsBuilder<((),)>;
  24. type StaticOutput = SomeProps;
  25. fn builder() -> Self::Builder {
  26. SomeProps::builder()
  27. }
  28. unsafe fn into_static(self) -> Self {
  29. self
  30. }
  31. }